When I try to make backups on my windows machine I get errors on the generated files path/filename to long. Is it possible to create files with shorter names?

\sites\default\files\public\advagg_css\css-2W9ipzbHHjwM-2A39YINQk8gqhftc3itIoRl_cHlM__geTUFVWFERolMwwi5-OMuutcYvGyfKbDPFZ8M9z5WPU__NJHPFb1qsShfVaqLY4Gcy6bTI97bNWbE5QSxVEZYEB8.css

Comments

anniekvandijk created an issue. See original summary.

mikeytown2’s picture

Status: Active » Closed (works as designed)

Reducing the file length is not possible. You do not need to backup the advagg files; they will be re-generated on demand.

dealancer’s picture

Category: Support request » Feature request
Status: Closed (works as designed) » Active

HTTrack fails to crawl such long file names. It would be nice to have an option to reduce filename length.

mikeytown2’s picture

I'd file a bug report with https://forum.httrack.com/

AdvAgg is creates files that are 143 char long; leaving 112 char if the 255 limit is enforced.
http://stackoverflow.com/a/265782/125684
https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations

dealancer’s picture

Status: Active » Closed (works as designed)

It appears problem is not even in the long file names, but rather in length of path to the files on local machine. HTTrack is truncating files so the full path to file does not exceed 237 characters. See https://forum.httrack.com/readmsg/35614/index.html for more details.

I am closing this issue.

mikeytown2’s picture

Note that changing the file length could be possible; I'd want to make it swappable though.

drupal_hash_base64 is what's used but a crc32b hash with base64 encoding would result in a shorter filename but with a much higher chance of a hash collision.

All of this to say that if a patch landed I'd look into getting it in; I will not be the one writing it though. The 43 char limit is baked in so a patch like this would be pretty hard to pull off.

The other option is to encode the 3 hashes into 1 hash. Once again lots of changes would need to be made to make this happen.

The final option is to hack advagg.module and change ADVAGG_SPACE to be ''. This would shorten the filenames by 6 char; in theory this should work but I might have missed something causing issues.

marioangulo’s picture

Been doing some changes on the contrib module with no luck on truncating the filename. Question that I wanted to ask would it be a better solution to use something like a UUID to target files and filenames for this module or would that be a bigger issue?

mikeytown2’s picture

The 3 long hashes are baked into the code pretty heavily. If you want to shorten it I think hook_url_inbound_alter() could be used to transform inbound urls back into the 3 long hashes; for outbound hook_file_url_alter() might be all that's needed to shorten the 3 into something smaller.

I'm open to patches that would allow for this to happen; default should be the 3 long hashes though.