palz-connector 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/media.ts +9 -1
package/dist/index.cjs
CHANGED
|
@@ -280390,7 +280390,14 @@ async function loadMediaAsOssUrl(mediaUrl, log) {
|
|
|
280390
280390
|
}
|
|
280391
280391
|
}
|
|
280392
280392
|
const rawPath = mediaUrl.replace(/^MEDIA:/, "");
|
|
280393
|
-
|
|
280393
|
+
let filePath;
|
|
280394
|
+
if (import_path3.default.isAbsolute(rawPath)) {
|
|
280395
|
+
filePath = rawPath;
|
|
280396
|
+
} else {
|
|
280397
|
+
const basename = rawPath.replace(/^\.?\/?media\//, "");
|
|
280398
|
+
const mediaFilePath = import_path3.default.join(MEDIA_DIR, basename);
|
|
280399
|
+
filePath = import_fs3.default.existsSync(mediaFilePath) ? mediaFilePath : import_path3.default.resolve(rawPath);
|
|
280400
|
+
}
|
|
280394
280401
|
if (import_fs3.default.existsSync(filePath)) {
|
|
280395
280402
|
try {
|
|
280396
280403
|
const ossUrl = await uploadFileToOss(filePath, log);
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/media.ts
CHANGED
|
@@ -148,7 +148,15 @@ export async function loadMediaAsOssUrl(
|
|
|
148
148
|
|
|
149
149
|
// 本地文件路径(绝对或相对)→ 上传到 OSS
|
|
150
150
|
const rawPath = mediaUrl.replace(/^MEDIA:/, "");
|
|
151
|
-
|
|
151
|
+
let filePath: string;
|
|
152
|
+
if (path.isAbsolute(rawPath)) {
|
|
153
|
+
filePath = rawPath;
|
|
154
|
+
} else {
|
|
155
|
+
// 相对路径优先在 MEDIA_DIR 下查找(如 ./media/xxx 取 xxx 部分)
|
|
156
|
+
const basename = rawPath.replace(/^\.?\/?media\//, "");
|
|
157
|
+
const mediaFilePath = path.join(MEDIA_DIR, basename);
|
|
158
|
+
filePath = fs.existsSync(mediaFilePath) ? mediaFilePath : path.resolve(rawPath);
|
|
159
|
+
}
|
|
152
160
|
if (fs.existsSync(filePath)) {
|
|
153
161
|
try {
|
|
154
162
|
const ossUrl = await uploadFileToOss(filePath, log);
|