Skip to content

Commit 0f0d1a1

Browse files
committed
fix: Remove mod_zip workaround for upstream subrequests to internal locations
Related `mod_zip` issue evanmiller/mod_zip#90 has been fixed in commit evanmiller/mod_zip@288d665 By upgrading `mod_zip` to include this fix, we can remove the workaround that involved using a separate internal location and server to serve files for zipping.
1 parent 8399e86 commit 0f0d1a1

3 files changed

Lines changed: 2 additions & 27 deletions

File tree

backend/endpoints/rom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ async def create_zip_content(f: RomFile, base_path: str = LIBRARY_BASE_PATH):
542542
filename=f.file_name_for_download(rom, hidden_folder),
543543
)
544544

545-
content_lines = [await create_zip_content(f, "/library-zip") for f in files]
545+
content_lines = [await create_zip_content(f, "/library") for f in files]
546546

547547
if not rom.has_m3u_file():
548548
m3u_encoded_content = "\n".join(

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ ARG NGINX_VERSION
115115
# The specified commit SHA is the latest commit on the `master` branch at the time of writing.
116116
# It includes a fix to correctly calculate CRC-32 checksums when using upstream subrequests.
117117
# TODO: Move to a tagged release of `mod_zip`, once a version newer than 1.3.0 is released.
118-
ARG NGINX_MOD_ZIP_SHA=8e65b82c82c7890f67a6107271c127e9881b6313
118+
ARG NGINX_MOD_ZIP_SHA=a9f9afa441117831cc712a832c98408b3f0416f6
119119

120120
# Clone both nginx and `ngx_http_zip_module` repositories, needed to compile the module from source.
121121
# This is needed to be able to dinamically load it as a module in the final image. `nginx` Docker

docker/nginx/templates/default.conf.template

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,9 @@ server {
7070
alias "${ROMM_BASE_PATH}/library/";
7171
}
7272

73-
# This location, and the related server at port 8081, are used to serve files when
74-
# using the `mod_zip` module. This is because the `mod_zip` module does not support
75-
# calculating CRC-32 values when using subrequests pointing directly to internal
76-
# locations that access the filesystem.
77-
# TODO: If that gets fixed, this workaround can be removed, and the `/library` location
78-
# can be used directly (also removing the server at port 8081).
79-
# Related issue: https://github.com/evanmiller/mod_zip/issues/90
80-
location /library-zip {
81-
internal;
82-
rewrite ^/library-zip/(.*)$ /library/$1 break;
83-
proxy_pass http://localhost:8081;
84-
# Proxy buffering must be disabled, for the module to correctly calculate CRC-32 values.
85-
proxy_buffering off;
86-
}
87-
8873
# Internal decoding endpoint, used to decode base64 encoded data
8974
location /decode {
9075
internal;
9176
js_content decode.decodeBase64;
9277
}
9378
}
94-
95-
server {
96-
listen 8081;
97-
listen [::]:8081;
98-
server_name localhost;
99-
100-
location /library/ {
101-
alias "${ROMM_BASE_PATH}/library/";
102-
}
103-
}

0 commit comments

Comments
 (0)