factorio-init icon indicating copy to clipboard operation
factorio-init copied to clipboard

Missing Content-Disposition header causes install script to fail

Open MisterPhilip opened this issue 2 years ago • 4 comments

It appears that one of the headers that was used to grab the file name no longer exists from the download URLs.

When running install (or update, if manually installed), this is the output:

factorio@factorio:/opt/factorio-init$ ./factorio install
DEBUG: Check/Loading config defaults for command 'install'
DEBUG: Skip check/loading defaults for command 'install'
DEBUG: Checking for latest headless version.
DEBUG: Found, latest version: ''
DEBUG: as_user: test -w "/tmp"}
DEBUG: No cache hit for ''.
DEBUG: as_user: wget -O "/tmp/" "https://www.factorio.com/get-download/stable/headless/linux64"}
/tmp/: Is a directory
Aborting install, unable to download & cache '/tmp/'.

Running curl against the latest URL these are the headers returned:

factorio@factorio:/opt/factorio-init$ curl -LIs "https://www.factorio.com/get-download/stable/headless/linux64"
HTTP/2 302
date: Wed, 09 Mar 2022 03:04:31 GMT
content-type: text/html; charset=utf-8
content-length: 424
location: https://dl.factorio.com/releases/factorio_headless_x64_1.1.53.tar.xz?secure=HEdDYInwVHq2GXeT8aqxIw,1646798671
x-frame-options: SAMEORIGIN
vary: Accept-Encoding, Cookie
strict-transport-security: max-age=31536000
set-cookie: session=eyJ2aXNpdG9yX2lkIjoiNGZjZDg0MmNlYzMzZDM3OSJ9.YigZPw.A9WNfVCTnuafxVwwxpnSO3xTH5g; Domain=.factorio.com; Secure; HttpOnly; Path=/
via: 1.1 vegur
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2B%2F%2BQpBB36wi5TRMwSggGx82EabQqA2H%2F6HeJVZ0eDLmqygJhLkNErzcGTrt1UZnFH%2FBZhjhMCoxEC69AbMboH64CsT2XgBmPiSbRdcUMnQtKhBe9sFzYQZwo6s7DfHhE1uyM%2B7Kmuiq5XBgWfuk%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 6e9095692a207c50-LAX

HTTP/2 200
date: Wed, 09 Mar 2022 03:04:31 GMT
content-type: application/octet-stream
content-length: 52117820
last-modified: Wed, 19 Jan 2022 10:33:59 GMT
etag: "61e7e917-31b413c"
access-control-allow-origin: *
x-accel-expires: @1647266797
server: CDN77-Turbo
x-77-nzt: AVm7uwoa2An/Up8IAA
x-77-nzt-ray: lpBG9iC6pu0
x-cache: HIT
x-age: 565074
x-77-pop: losangelesUSCA
x-77-cache: HIT
accept-ranges: bytes

It looks like the code is expecting Content-Disposition, which doesn't exist anymore. https://github.com/Bisa/factorio-init/blob/35d82197d67e73491475ddfc6bbb005a19633d5c/factorio#L484

I've tried from a few different computers, including a friend in another state and they also were not seeing the header on the request.

MisterPhilip avatar Mar 09 '22 03:03 MisterPhilip

@MisterPhilip hi, by any chance, did you find a workaround ?

imakiro avatar Apr 03 '22 23:04 imakiro

@imakiro - I did not; I ended up installing Factorio directly from the tarball (https://www.factorio.com/get-download/stable/headless/linux64)

MisterPhilip avatar Apr 04 '22 16:04 MisterPhilip

Ok, thanks to @greenblood , I fixed it in my branch : https://github.com/imakiro/factorio-init/tree/fix-install relevant code part : https://github.com/imakiro/factorio-init/commit/f1448f470167a4697a0c57a6dc5b6f39f1f34db1

imakiro avatar Apr 06 '22 16:04 imakiro

Hello, i will make a PR using the api to fetch the latest release: https://wiki.factorio.com/Download_API https://factorio.com/api/latest-releases

(something like this) image

Legrems avatar Apr 09 '22 23:04 Legrems