From e791601c00b160e983e70ade5153fbd2d8f3534b Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 14 Jan 2020 10:31:57 +0800 Subject: [PATCH] ComposerUpdate --- app/admin/view/api/upload.js | 2 +- composer.lock | 8 ++-- vendor/composer/installed.json | 8 ++-- vendor/services.php | 2 +- .../zoujingli/think-library/src/Storage.php | 42 +++++++++++-------- .../src/storage/AliossStorage.php | 5 ++- .../src/storage/LocalStorage.php | 3 +- .../src/storage/QiniuStorage.php | 3 +- 8 files changed, 41 insertions(+), 32 deletions(-) diff --git a/app/admin/view/api/upload.js b/app/admin/view/api/upload.js index 7409847a0..91c92d37b 100644 --- a/app/admin/view/api/upload.js +++ b/app/admin/view/api/upload.js @@ -41,7 +41,7 @@ define(['md5'], function (SparkMD5, allowExtsMimes) { uploader.config.data.signature = ret.data.signature; uploader.config.data.OSSAccessKeyId = ret.data.OSSAccessKeyId; uploader.config.data.success_action_status = 200; - uploader.config.data['Content-Disposition'] = 'attachment;filename=' + encodeURIComponent(file.name); + uploader.config.data['Content-Disposition'] = 'inline;filename=' + encodeURIComponent(file.name); } object.upload(index, file); } else if (parseInt(ret.code) === 200) { diff --git a/composer.lock b/composer.lock index cd5f51d16..d4c480c13 100644 --- a/composer.lock +++ b/composer.lock @@ -909,12 +909,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c" + "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/92ed0becfcfd239929b0ec64afca3618b6a3383c", - "reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4b5d056a51c18261255b728d7ef2f40c5779805b", + "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b", "shasum": "", "mirrors": [ { @@ -958,7 +958,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2020-01-13T09:00:03+00:00" + "time": "2020-01-14T02:21:11+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 9b0caa4d7..04a147bb6 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -935,12 +935,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c" + "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/92ed0becfcfd239929b0ec64afca3618b6a3383c", - "reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4b5d056a51c18261255b728d7ef2f40c5779805b", + "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b", "shasum": "", "mirrors": [ { @@ -956,7 +956,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2020-01-13T09:00:03+00:00", + "time": "2020-01-14T02:21:11+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index f5aa5ca30..e803d7c12 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/Storage.php b/vendor/zoujingli/think-library/src/Storage.php index 13138156a..944d1da06 100644 --- a/vendor/zoujingli/think-library/src/Storage.php +++ b/vendor/zoujingli/think-library/src/Storage.php @@ -41,11 +41,17 @@ abstract class Storage protected $app; /** - * 存储域名前缀 + * 链接前缀 * @var string */ protected $prefix; + /** + * 链接类型 + * @var string + */ + protected $linkType; + /** * Storage constructor. * @param App $app @@ -58,9 +64,13 @@ abstract class Storage /** * 存储初始化 * @return Storage + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ protected function initialize(): Storage { + $this->linkType = sysconf('storage.link_type'); return $this; } @@ -167,30 +177,14 @@ abstract class Storage return $mimes = include __DIR__ . '/storage/bin/mimes.php'; } - /** - * 获取文件基础名称 - * @param string $name 文件名称 - * @return string - */ - protected function delSuffix($name) - { - if (strpos($name, '?') !== false) { - list($name) = explode('?', $name); - } - return $name; - } - /** * 获取下载链接后缀 * @param string $attname 下载名称 * @return string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException */ protected function getSuffix($attname = null) { - if (sysconf('storage.link_type') === 'full') { + if ($this->linkType === 'full') { if (is_string($attname) && strlen($attname) > 0) { return "?attname=" . urlencode($attname); } @@ -198,4 +192,16 @@ abstract class Storage return ''; } + /** + * 获取文件基础名称 + * @param string $name 文件名称 + * @return string + */ + protected function delSuffix($name) + { + if (strpos($name, '?') !== false) { + return strstr($name, '?', true); + } + return $name; + } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/storage/AliossStorage.php b/vendor/zoujingli/think-library/src/storage/AliossStorage.php index 34c44cd80..8952cc952 100644 --- a/vendor/zoujingli/think-library/src/storage/AliossStorage.php +++ b/vendor/zoujingli/think-library/src/storage/AliossStorage.php @@ -77,7 +77,8 @@ class AliossStorage extends Storage elseif ($type === 'http') $this->prefix = "http://{$this->domain}"; elseif ($type === 'https') $this->prefix = "https://{$this->domain}"; else throw new \think\Exception('未配置阿里云URL域名哦'); - return $this; + // 初始化配置并返回当前实例 + return parent::initialize(); } /** @@ -112,7 +113,7 @@ class AliossStorage extends Storage $data['success_action_status'] = '200'; if (is_string($attname) && strlen($attname) > 0) { $filename = urlencode($attname); - $data['Content-Disposition'] = "attachment;filename={$filename}"; + $data['Content-Disposition'] = "inline;filename={$filename}"; } $file = ['field' => 'file', 'name' => $name, 'content' => $file]; if (is_numeric(stripos(HttpExtend::submit($this->upload(), $data, $file), '200 OK'))) { diff --git a/vendor/zoujingli/think-library/src/storage/LocalStorage.php b/vendor/zoujingli/think-library/src/storage/LocalStorage.php index a32a9054e..48e6257c8 100644 --- a/vendor/zoujingli/think-library/src/storage/LocalStorage.php +++ b/vendor/zoujingli/think-library/src/storage/LocalStorage.php @@ -46,7 +46,8 @@ class LocalStorage extends Storage elseif ($type === 'http') $this->prefix = "http://{$domain}"; elseif ($type === 'https') $this->prefix = "https://{$domain}"; } - return $this; + // 初始化配置并返回当前实例 + return parent::initialize(); } /** diff --git a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php index 6df929683..c7640301c 100644 --- a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php +++ b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php @@ -51,7 +51,8 @@ class QiniuStorage extends Storage elseif ($type === 'http') $this->prefix = "http://{$this->domain}"; elseif ($type === 'https') $this->prefix = "https://{$this->domain}"; else throw new \think\Exception('未配置七牛云URL域名哦'); - return $this; + // 初始化配置并返回当前实例 + return parent::initialize(); } /**