Skip to content

Commit 08616e6

Browse files
authored
Fix/image url (#129)
* fix * fix
1 parent 969c3a0 commit 08616e6

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

bizyui/js/model_apply.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ const NodeInfoLogger = (function() {
4949
let imageUrl;
5050
let headers = {};
5151

52-
if (isServerMode) {
53-
// 服务器模式,改为请求后端转发接口
52+
// 检查 filename 是否是完整的 URL(以 http:// 或 https:// 开头)
53+
const isFullUrl = filename.startsWith('http://') || filename.startsWith('https://') ||
54+
filename.startsWith('http:/') || filename.startsWith('https:/');
55+
56+
if (isFullUrl) {
57+
imageUrl = filename.replace(/^(https?):\/(?!\/)/, '$1://');
58+
} else if (isServerMode) {
59+
// 服务器模式且非完整URL,使用后端转发接口
5460
imageUrl = `/bizyair/proxy_view?filename=${encodeURIComponent(filename)}`;
5561
} else {
5662
// 本地模式,使用原有 buildImageUrl
@@ -128,8 +134,15 @@ const NodeInfoLogger = (function() {
128134
filename = widgetsValues[0];
129135
}
130136
const path = `/${type}/${filename}`;
131-
let url;
132-
if (isServerMode) {
137+
let url;
138+
// 检查 filename 是否是完整的 URL
139+
const isFullUrl = filename.startsWith('http://') || filename.startsWith('https://') ||
140+
filename.startsWith('http:/') || filename.startsWith('https:/');
141+
142+
if (isFullUrl) {
143+
url = filename.replace(/^(https?):\/(?!\/)/, '$1://');
144+
} else if (isServerMode) {
145+
// 服务器模式且非完整URL,使用 /view 接口
133146
url = `/view?filename=${encodeURIComponent(filename)}`;
134147
} else {
135148
if (filename.startsWith('data:')) {

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.60
1+
1.2.61

0 commit comments

Comments
 (0)