Skip to content

Commit 19dd3e4

Browse files
committed
guaranteeing that cache keys don't exceed 140 characters
1 parent f00f1d8 commit 19dd3e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Downloader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ private static function generateCacheKey(string $url): string
423423
$url = preg_replace('{^https://api.github.com/repos/([^/]++/[^/]++)/contents/}', '$1/', $url);
424424
$url = preg_replace('{^https://raw.githubusercontent.com/([^/]++/[^/]++)/}', '$1/', $url);
425425

426-
return preg_replace('{[^a-z0-9.]}i', '-', $url);
426+
$key = preg_replace('{[^a-z0-9.]}i', '-', $url);
427+
428+
// eCryptfs can have problems with filenames longer than around 143 chars
429+
return \strlen($key) > 140 ? md5($url) : $key;
427430
}
428431
}

0 commit comments

Comments
 (0)