This commit is contained in:
huangjx
2022-04-27 23:09:47 +08:00
parent acd9470a4b
commit 32b6484596
4 changed files with 9 additions and 8 deletions

View File

@@ -70,14 +70,15 @@ class Helper
}
return $filename;
}
public static function getFilename($url)
public static function getFilename($url): string
{
if (self::isMagnet($url)) {
$filename = self::parseUrl($url)['dn'];
$info = self::parseUrl($url);
$filename = $info["dn"] ?? "";
} else {
$filename = self::getUrlPath($url);
}
return substr($filename, 0, self::MAXFILELEN);
return self::clipFilename($filename);
}
public static function formatBytes($size, $precision = 2)
{
@@ -483,6 +484,7 @@ class Helper
return false;
}
$checkFile = $dir . "/.lastmodified";
if (!file_exists($checkFile)) {
$time = \filemtime($dir);
file_put_contents($checkFile, $time);

View File

@@ -14,7 +14,7 @@ class folderScan
{
$this->user = $user ?? Helper::getUID();
$this->path = $path ?? $this->getDefaultPath();
$this->realDir = $realDir ?? Helper::getLocalFolder($this->path);
$this->realDir = Helper::getLocalFolder(Helper::getDownloadDir());
}
public function getDefaultPath()