regulate files names
append sha1 name suffix for the smaller duplicate file, thus unify the result for findfiles/get
This commit is contained in:
parent
47b7ee6703
commit
a3c35f89fa
14
get.php
14
get.php
@ -420,7 +420,14 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
|
|||||||
if($sha256capable) {
|
if($sha256capable) {
|
||||||
$tempname = uupCleanSha256($name);
|
$tempname = uupCleanSha256($name);
|
||||||
if(isset($files[$tempname])) {
|
if(isset($files[$tempname])) {
|
||||||
|
if($size > $files[$tempname]['size']) {
|
||||||
|
$smaller = uupAppendSha1($tempname, $files[$tempname]['sha1']);
|
||||||
|
$files[$smaller] = $files[$tempname];
|
||||||
|
unset($files[$tempname]);
|
||||||
|
$newName = $tempname;
|
||||||
|
} else {
|
||||||
$newName = uupAppendSha1($tempname, $sha1);
|
$newName = uupAppendSha1($tempname, $sha1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$newName = $tempname;
|
$newName = $tempname;
|
||||||
}
|
}
|
||||||
@ -492,7 +499,14 @@ function uupGetOfflineFiles($info) {
|
|||||||
if($sha256capable) {
|
if($sha256capable) {
|
||||||
$tempname = uupCleanSha256($name);
|
$tempname = uupCleanSha256($name);
|
||||||
if(isset($files[$tempname])) {
|
if(isset($files[$tempname])) {
|
||||||
|
if($size > $files[$tempname]['size']) {
|
||||||
|
$smaller = uupAppendSha1($tempname, $files[$tempname]['sha1']);
|
||||||
|
$files[$smaller] = $files[$tempname];
|
||||||
|
unset($files[$tempname]);
|
||||||
|
$newName = $tempname;
|
||||||
|
} else {
|
||||||
$newName = uupAppendSha1($tempname, $sha1);
|
$newName = uupAppendSha1($tempname, $sha1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$newName = $tempname;
|
$newName = $tempname;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user