Skip to content

Commit ee1bff1

Browse files
committed
guaranteeing that cache keys don't exceed 140 characters
1 parent a90526b commit ee1bff1

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
@@ -447,6 +447,9 @@ private static function generateCacheKey(string $url): string
447447
$url = preg_replace('{^https://api.github.com/repos/([^/]++/[^/]++)/contents/}', '$1/', $url);
448448
$url = preg_replace('{^https://raw.githubusercontent.com/([^/]++/[^/]++)/}', '$1/', $url);
449449

450-
return preg_replace('{[^a-z0-9.]}i', '-', $url);
450+
$key = preg_replace('{[^a-z0-9.]}i', '-', $url);
451+
452+
// eCryptfs can have problems with filenames longer than around 143 chars
453+
return \strlen($key) > 140 ? md5($url) : $key;
451454
}
452455
}

0 commit comments

Comments
 (0)