Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to follow 307 redirections #790

Open
djrarky opened this issue Mar 2, 2025 · 5 comments
Open

Unable to follow 307 redirections #790

djrarky opened this issue Mar 2, 2025 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@djrarky
Copy link

djrarky commented Mar 2, 2025

I'm ussing immich upload optimizer to losslessly compress images, but when using immich-go, it refuses to allow 307 redirects. A single photo uploads upon every run, but then fails.
https://github.com/miguelangel-nubla/immich-upload-optimizer

It has been identified to be an issue with immich-go, is it possible to allow the app to follow 307 redirects? Thank you so so much!

miguelangel-nubla/immich-upload-optimizer#15

@simulot simulot added bug Something isn't working enhancement New feature or request labels Mar 2, 2025
@simulot simulot self-assigned this Mar 2, 2025
@simulot
Copy link
Owner

simulot commented Mar 3, 2025

It more complex than expected.

@simulot
Copy link
Owner

simulot commented Mar 6, 2025

Considering this idea:

Immich-go detects duplicates based on the file name and file size. Immich detects duplicates based on the file's hash.

I believe the optimization process will undermine all deduplication efforts because both the file size and hash are affected by optimization.

The first time a file is uploaded, Immich stores an optimized version of the image.

The next time, Immich-go will not recognize the file due to the size difference and will submit it to Immich, where it undergoes optimization again. If the optimization results in the same file, Immich will reject it, making the optimization and the upload redundant. If the optimization generates a slightly different file, Immich will accept it, leading to duplicate images.

@ArnaudCrl
Copy link

I just stumbled upon this exact issue when immich upload optimizer and immich-go try to interact. It would be nice to have a fix or a workaround. Thank you for your work !

@kotx
Copy link

kotx commented Mar 8, 2025

Maybe we could feature request immich-upload-optimizer to return a X-Optimized-File-Hash header or something.

@simulot
Copy link
Owner

simulot commented Mar 9, 2025

I don't think it is needed. The 307 is detected but it's difficult to handle directly. The 1st 32k of the flow are consumed during the initial call, and must be resubmitted to the redirected address.

I need to change the way of building the upload flow to cope with this. It's on my todo list, after the stabilization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants