forked from uup-dump/api
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
18
get.php
18
get.php
@ -420,7 +420,14 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
|
||||
if($sha256capable) {
|
||||
$tempname = uupCleanSha256($name);
|
||||
if(isset($files[$tempname])) {
|
||||
$newName = uupAppendSha1($tempname, $sha1);
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
$newName = $tempname;
|
||||
}
|
||||
@ -492,7 +499,14 @@ function uupGetOfflineFiles($info) {
|
||||
if($sha256capable) {
|
||||
$tempname = uupCleanSha256($name);
|
||||
if(isset($files[$tempname])) {
|
||||
$newName = uupAppendSha1($tempname, $sha1);
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
$newName = $tempname;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user