Skip to content

Commit 43e43ca

Browse files
authored
Merge pull request Kujiale-Mobile#348 from jackwangyubo/master
增加对微信云存储图片的支持
2 parents 58158a8 + 3cfac89 commit 43e43ca

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

components/painter/lib/downloader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ function transformBase64File(base64data, lru) {
176176

177177
function downloadFile(url, lru) {
178178
return new Promise((resolve, reject) => {
179-
wx.downloadFile({
179+
const downloader = url.startsWith('cloud://')?wx.cloud.downloadFile:wx.downloadFile
180+
downloader({
180181
url: url,
182+
fileID: url,
181183
success: function (res) {
182184
if (res.statusCode !== 200) {
183185
console.error(`downloadFile ${url} failed res.statusCode is not 200`);

components/painter/lib/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function isValidUrl(url) {
44
}
55

66
function isOnlineUrl(url) {
7-
return /(ht|f)tp(s?):\/\/([^ \\/]*\.)+[^ \\/]*(:[0-9]+)?\/?/.test(url)
7+
return /((ht|f)tp(s?)|cloud):\/\/([^ \\/]*\.)+[^ \\/]*(:[0-9]+)?\/?/.test(url)
88
}
99

1010
function isDataUrl(url) {

0 commit comments

Comments
 (0)