@ynhcj/xiaoyi-channel 0.0.71-beta → 0.0.73-beta
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.
|
@@ -61,6 +61,14 @@ export const saveMediaToGalleryTool = {
|
|
|
61
61
|
if (mediaType && !["pic", "video"].includes(mediaType)) {
|
|
62
62
|
throw new ToolInputError(`mediaType只支持 pic 或 video,当前值: ${mediaType}`);
|
|
63
63
|
}
|
|
64
|
+
// Strip file extension from fileName if present
|
|
65
|
+
let sanitizedFileName = fileName;
|
|
66
|
+
if (sanitizedFileName && typeof sanitizedFileName === "string") {
|
|
67
|
+
const lastDot = sanitizedFileName.lastIndexOf(".");
|
|
68
|
+
if (lastDot > 0) {
|
|
69
|
+
sanitizedFileName = sanitizedFileName.substring(0, lastDot);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
64
72
|
// Get session context
|
|
65
73
|
const sessionContext = getCurrentSessionContext();
|
|
66
74
|
if (!sessionContext) {
|
|
@@ -86,8 +94,8 @@ export const saveMediaToGalleryTool = {
|
|
|
86
94
|
if (mediaType) {
|
|
87
95
|
intentParam.mediaType = mediaType;
|
|
88
96
|
}
|
|
89
|
-
if (
|
|
90
|
-
intentParam.fileName =
|
|
97
|
+
if (sanitizedFileName) {
|
|
98
|
+
intentParam.fileName = sanitizedFileName;
|
|
91
99
|
}
|
|
92
100
|
// Build SaveMediaToGallery command
|
|
93
101
|
const command = {
|