@gallop.software/studio 2.3.35 → 2.3.37

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.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-BKhGFWRa.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-Cxfnf-5i.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -1435,6 +1435,7 @@ async function handleRenameStream(request) {
1435
1435
  const isImagePath = isImageFile(path6.basename(oldPath));
1436
1436
  let hasLocalItem = false;
1437
1437
  let isFile = true;
1438
+ let isVirtualFolder = false;
1438
1439
  try {
1439
1440
  const stats = await fs6.stat(absoluteOldPath);
1440
1441
  hasLocalItem = true;
@@ -1443,12 +1444,20 @@ async function handleRenameStream(request) {
1443
1444
  const meta2 = await loadMeta();
1444
1445
  const oldKey2 = "/" + oldRelativePath;
1445
1446
  const entry2 = meta2[oldKey2];
1446
- if (!entry2) {
1447
- sendEvent({ type: "error", message: "File or folder not found" });
1448
- controller.close();
1449
- return;
1447
+ if (entry2) {
1448
+ isFile = true;
1449
+ } else {
1450
+ const folderPrefix = oldKey2 + "/";
1451
+ const hasChildrenInMeta = Object.keys(meta2).some((key) => key.startsWith(folderPrefix));
1452
+ if (hasChildrenInMeta) {
1453
+ isFile = false;
1454
+ isVirtualFolder = true;
1455
+ } else {
1456
+ sendEvent({ type: "error", message: "File or folder not found" });
1457
+ controller.close();
1458
+ return;
1459
+ }
1450
1460
  }
1451
- isFile = true;
1452
1461
  }
1453
1462
  const sanitizedName = isFile ? slugifyFilename(newName) : slugifyFolderName(newName);
1454
1463
  if (!sanitizedName) {
@@ -1470,12 +1479,23 @@ async function handleRenameStream(request) {
1470
1479
  return;
1471
1480
  }
1472
1481
  }
1473
- try {
1474
- await fs6.access(absoluteNewPath);
1475
- sendEvent({ type: "error", message: "An item with this name already exists" });
1476
- controller.close();
1477
- return;
1478
- } catch {
1482
+ if (!isVirtualFolder) {
1483
+ try {
1484
+ await fs6.access(absoluteNewPath);
1485
+ sendEvent({ type: "error", message: "An item with this name already exists" });
1486
+ controller.close();
1487
+ return;
1488
+ } catch {
1489
+ }
1490
+ }
1491
+ if (isVirtualFolder) {
1492
+ const newPrefix = "/" + newRelativePath + "/";
1493
+ const hasConflict = Object.keys(meta).some((key) => key.startsWith(newPrefix));
1494
+ if (hasConflict) {
1495
+ sendEvent({ type: "error", message: "A folder with this name already exists" });
1496
+ controller.close();
1497
+ return;
1498
+ }
1479
1499
  }
1480
1500
  if (!isFile) {
1481
1501
  const oldPrefix = "/" + oldRelativePath + "/";