next-image-export-optimizer icon indicating copy to clipboard operation
next-image-export-optimizer copied to clipboard

Filenames too long with long urls

Open ibobo opened this issue 1 year ago • 2 comments

Hi, when remote urls are very long (for example when using Instagram images) the filename gets too long (over 256 chars) and the optimization fails with Error: ENAMETOOLONG: name too long. I suggest using an sha1 of the URL to encode the filename.

ibobo avatar Jul 18 '23 10:07 ibobo

Hi @ibobo, Thanks for the suggestion. The problem is that there is no good hashing algorithm available in the client environment. The browser crypto option is only available for https connections. Do you have a suggestion that doesn't blow up the package size?

Niels-IO avatar Jul 20 '23 12:07 Niels-IO

@Niels-IO Have you considered jsSHA? It allows loading individual algorithms to keep the bundle size low.

stx-chris avatar Nov 06 '23 06:11 stx-chris

I used a hash function which I found on Stack Overflow in v1.14.0. This should get rid of the problem with long urls. Could you please confirm?

Niels-IO avatar Jun 09 '24 21:06 Niels-IO