@gallop.software/studio 2.3.44 → 2.3.46

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.
@@ -1758,7 +1758,21 @@ async function handleMoveStream(request) {
1758
1758
  }
1759
1759
  return count;
1760
1760
  };
1761
- totalFiles += await countFilesRecursive(absolutePath);
1761
+ const localFileCount = await countFilesRecursive(absolutePath);
1762
+ const folderPrefix = oldKey + "/";
1763
+ let cloudOnlyCount = 0;
1764
+ for (const metaKey of Object.keys(meta)) {
1765
+ if (metaKey.startsWith(folderPrefix)) {
1766
+ const relPath = metaKey.slice(folderPrefix.length);
1767
+ const localPath = path6.join(absolutePath, relPath);
1768
+ try {
1769
+ await fs6.access(localPath);
1770
+ } catch {
1771
+ cloudOnlyCount++;
1772
+ }
1773
+ }
1774
+ }
1775
+ totalFiles += localFileCount + cloudOnlyCount;
1762
1776
  expandedItems.push({ itemPath, safePath, itemName, oldKey, newKey, newAbsolutePath, isVirtualFolder: false });
1763
1777
  } else if (!hasLocalItem) {
1764
1778
  const folderPrefix = oldKey + "/";
@@ -1794,6 +1808,7 @@ async function handleMoveStream(request) {
1794
1808
  const itemCdnUrl = isItemInCloud ? cdnUrls[itemEntry.c] : void 0;
1795
1809
  const isItemInR2 = isItemInCloud && itemCdnUrl === r2PublicUrl;
1796
1810
  const itemHasThumbnails = isProcessed(itemEntry);
1811
+ let vItemMoved = false;
1797
1812
  if (isItemInR2) {
1798
1813
  try {
1799
1814
  const itemLocalPath = getPublicPath(vItem.newKey);
@@ -1825,12 +1840,16 @@ async function handleMoveStream(request) {
1825
1840
  if (itemHasThumbnails) {
1826
1841
  await deleteLocalThumbnails(vItem.newKey);
1827
1842
  }
1843
+ vItemMoved = true;
1828
1844
  } catch (err) {
1829
1845
  console.error(`Failed to move cloud item ${vItem.oldKey}:`, err);
1846
+ delete meta[vItem.oldKey];
1830
1847
  }
1831
1848
  }
1832
- delete meta[vItem.oldKey];
1833
- meta[vItem.newKey] = itemEntry;
1849
+ if (vItemMoved) {
1850
+ delete meta[vItem.oldKey];
1851
+ meta[vItem.newKey] = itemEntry;
1852
+ }
1834
1853
  processedFiles++;
1835
1854
  sendEvent({
1836
1855
  type: "progress",
@@ -2106,6 +2125,7 @@ async function handleMoveStream(request) {
2106
2125
  const cloudCdnUrl = cloudIsInCloud ? cdnUrls[cloudEntry.c] : void 0;
2107
2126
  const cloudIsInR2 = cloudIsInCloud && cloudCdnUrl === r2PublicUrl;
2108
2127
  const cloudHasThumbs = isProcessed(cloudEntry);
2128
+ let cloudFileMoved = false;
2109
2129
  if (cloudIsInR2) {
2110
2130
  try {
2111
2131
  const cloudLocalPath = getPublicPath(cloudFile.newKey);
@@ -2138,12 +2158,16 @@ async function handleMoveStream(request) {
2138
2158
  await deleteLocalThumbnails(cloudFile.newKey);
2139
2159
  }
2140
2160
  await deleteEmptyFolders(path6.dirname(cloudLocalPath));
2161
+ cloudFileMoved = true;
2141
2162
  } catch (err) {
2142
2163
  console.error(`Failed to move cloud file ${cloudFile.oldKey}:`, err);
2164
+ delete meta[cloudFile.oldKey];
2143
2165
  }
2144
2166
  }
2145
- delete meta[cloudFile.oldKey];
2146
- meta[cloudFile.newKey] = cloudEntry;
2167
+ if (cloudFileMoved) {
2168
+ delete meta[cloudFile.oldKey];
2169
+ meta[cloudFile.newKey] = cloudEntry;
2170
+ }
2147
2171
  processedFiles++;
2148
2172
  sendEvent({
2149
2173
  type: "progress",