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 CHANGED
@@ -280390,7 +280390,14 @@ async function loadMediaAsOssUrl(mediaUrl, log) {
280390
280390
  }
280391
280391
  }
280392
280392
  const rawPath = mediaUrl.replace(/^MEDIA:/, "");
280393
- const filePath = import_path3.default.isAbsolute(rawPath) ? rawPath : import_path3.default.resolve(rawPath);
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);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "palz-connector",
3
3
  "name": "Palz Connector Channel",
4
- "version": "1.1.6",
4
+ "version": "1.1.7",
5
5
  "description": "Palz IM 接入 OpenClaw",
6
6
  "channels": [
7
7
  "palz-connector"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palz-connector",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "scripts": {
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
- const filePath = path.isAbsolute(rawPath) ? rawPath : path.resolve(rawPath);
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);