Commit 237736c1 authored by Manfred Kutas's avatar Manfred Kutas

ZP-895 Check in contentData if the generated folderid already exists

instead of checking for it in cache.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 8cc944af
......@@ -966,7 +966,7 @@ class ASDevice extends StateObject {
$cnt = 0;
// Collision avoiding. Append an increasing number to the string to hash
// until there aren't any collisions. Probably a smaller number is also sufficient.
while (in_array($folderId, $this->backend2folderidCache) && $cnt < 10000) {
while (isset($this->contentData[$folderId]) && $cnt < 10000) {
$folderId = substr($folderOrigin . dechex(crc32($backendid . $folderName . $cnt++)), 0, 6);
ZLog::Write(LOGLEVEL_WARN, sprintf("ASDevice->generateFolderHash(): collision avoiding nr %05d. Generated hash: '%s'", $cnt, $folderId));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment