From c1939aebd1da1125ace2ebcc03ea6d913bc34bed Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 10 Feb 2020 16:39:05 +1000 Subject: [PATCH] when adding hash suffix, need length in hex, not bytes --- rslib/src/media/files.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rslib/src/media/files.rs b/rslib/src/media/files.rs index e1885d1d4..a07b458f4 100644 --- a/rslib/src/media/files.rs +++ b/rslib/src/media/files.rs @@ -176,8 +176,8 @@ where /// Convert foo.jpg into foo-abcde12345679.jpg fn add_hash_suffix_to_file_stem(fname: &str, hash: &[u8; 20]) -> String { - // when appending a hash to make unique, it will be 20 bytes plus the hyphen. - let max_len = MAX_FILENAME_LENGTH - 20 - 1; + // when appending a hash to make unique, it will be 40 bytes plus the hyphen. + let max_len = MAX_FILENAME_LENGTH - 40 - 1; let (stem, ext) = split_and_truncate_filename(fname, max_len);