@leoqlin/openclaw-qqbot 1.6.11 → 1.6.13

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.
@@ -29,11 +29,15 @@ export function createMediaTagRegex() {
29
29
  export function fixPathEncoding(mediaPath, log) {
30
30
  // 1. 双反斜杠 -> 单反斜杠(Markdown 转义)
31
31
  let result = mediaPath.replace(/\\\\/g, "\\");
32
+ // Skip octal escape decoding for Windows local paths (e.g. C:\Users\1\file.txt)
33
+ // where backslash-digit sequences like \1, \2 ... \7 are directory separators,
34
+ // not octal escape sequences.
35
+ const isWinLocal = /^[a-zA-Z]:[\\/]/.test(mediaPath) || mediaPath.startsWith("\\\\");
32
36
  // 2. 八进制转义序列 + UTF-8 双重编码修复
33
37
  try {
34
38
  const hasOctal = /\\[0-7]{1,3}/.test(result);
35
39
  const hasNonASCII = /[\u0080-\u00FF]/.test(result);
36
- if (hasOctal || hasNonASCII) {
40
+ if (!isWinLocal && (hasOctal || hasNonASCII)) {
37
41
  log?.debug?.(`Decoding path with mixed encoding: ${result}`);
38
42
  // Step 1: 将八进制转义转换为字节
39
43
  let decoded = result.replace(/\\([0-7]{1,3})/g, (_, octal) => String.fromCharCode(parseInt(octal, 8)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leoqlin/openclaw-qqbot",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -72,12 +72,16 @@ export function fixPathEncoding(mediaPath: string, log?: { debug?: (msg: string)
72
72
  // 1. 双反斜杠 -> 单反斜杠(Markdown 转义)
73
73
  let result = mediaPath.replace(/\\\\/g, "\\");
74
74
 
75
+ // Skip octal escape decoding for Windows local paths (e.g. C:\Users\1\file.txt)
76
+ // where backslash-digit sequences like \1, \2 ... \7 are directory separators,
77
+ // not octal escape sequences.
78
+ const isWinLocal = /^[a-zA-Z]:[\\/]/.test(mediaPath) || mediaPath.startsWith("\\\\");
75
79
  // 2. 八进制转义序列 + UTF-8 双重编码修复
76
80
  try {
77
81
  const hasOctal = /\\[0-7]{1,3}/.test(result);
78
82
  const hasNonASCII = /[\u0080-\u00FF]/.test(result);
79
83
 
80
- if (hasOctal || hasNonASCII) {
84
+ if (!isWinLocal && (hasOctal || hasNonASCII)) {
81
85
  log?.debug?.(`Decoding path with mixed encoding: ${result}`);
82
86
 
83
87
  // Step 1: 将八进制转义转换为字节