@magentrix-corp/magentrix-cli 1.1.2 → 1.1.3
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/actions/publish.js +19 -3
- package/package.json +1 -1
package/actions/publish.js
CHANGED
|
@@ -194,9 +194,25 @@ const handleDeleteStaticAssetAction = async (instanceUrl, apiKey, action) => {
|
|
|
194
194
|
* Handles CREATE_FOLDER action.
|
|
195
195
|
*/
|
|
196
196
|
const handleCreateFolderAction = async (instanceUrl, apiKey, action) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
try {
|
|
198
|
+
const response = await createFolder(instanceUrl, apiKey, action.parentPath, action.folderName);
|
|
199
|
+
return response;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
// Check if folder already exists (likely created by file upload)
|
|
202
|
+
const errorMessage = error?.message || String(error);
|
|
203
|
+
const errorLower = errorMessage.toLowerCase();
|
|
204
|
+
const alreadyExists = errorLower.includes('already exists') ||
|
|
205
|
+
errorLower.includes('folder exists') ||
|
|
206
|
+
errorLower.includes('duplicate');
|
|
207
|
+
|
|
208
|
+
if (alreadyExists) {
|
|
209
|
+
// Folder already exists, update cache and treat as success
|
|
210
|
+
return { alreadyExisted: true };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Other errors should still fail
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
200
216
|
};
|
|
201
217
|
|
|
202
218
|
/**
|