@gallop.software/studio 1.0.0 → 1.0.1

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.
@@ -314,15 +314,25 @@ async function handleList(request) {
314
314
  try {
315
315
  const dirEntries = await fs4.readdir(absoluteDir, { withFileTypes: true });
316
316
  for (const entry of dirEntries) {
317
- if (entry.isDirectory() && !entry.name.startsWith(".")) {
317
+ if (entry.name.startsWith(".")) continue;
318
+ if (entry.isDirectory()) {
318
319
  if (!seenFolders.has(entry.name)) {
319
320
  seenFolders.add(entry.name);
320
321
  const isImagesFolder = entry.name === "images" && !relativePath;
321
322
  const folderPath = relativePath ? `public/${relativePath}/${entry.name}` : `public/${entry.name}`;
322
- const folderPrefix = pathPrefix === "/" ? `/${entry.name}/` : `${pathPrefix}${entry.name}/`;
323
323
  let fileCount = 0;
324
- for (const k of metaKeys) {
325
- if (k.startsWith(folderPrefix)) fileCount++;
324
+ if (isInsideImagesFolder || isImagesFolder) {
325
+ const subDir = path5.join(absoluteDir, entry.name);
326
+ try {
327
+ const subEntries = await fs4.readdir(subDir);
328
+ fileCount = subEntries.filter((f) => !f.startsWith(".")).length;
329
+ } catch {
330
+ }
331
+ } else {
332
+ const folderPrefix = pathPrefix === "/" ? `/${entry.name}/` : `${pathPrefix}${entry.name}/`;
333
+ for (const k of metaKeys) {
334
+ if (k.startsWith(folderPrefix)) fileCount++;
335
+ }
326
336
  }
327
337
  items.push({
328
338
  name: entry.name,
@@ -332,6 +342,25 @@ async function handleList(request) {
332
342
  isProtected: isImagesFolder || isInsideImagesFolder
333
343
  });
334
344
  }
345
+ } else if (isInsideImagesFolder) {
346
+ const filePath = relativePath ? `public/${relativePath}/${entry.name}` : `public/${entry.name}`;
347
+ const fullPath = path5.join(absoluteDir, entry.name);
348
+ let fileSize;
349
+ try {
350
+ const stats = await fs4.stat(fullPath);
351
+ fileSize = stats.size;
352
+ } catch {
353
+ }
354
+ const isImage = isImageFile(entry.name);
355
+ items.push({
356
+ name: entry.name,
357
+ path: filePath,
358
+ type: "file",
359
+ size: fileSize,
360
+ thumbnail: isImage ? `/${relativePath}/${entry.name}` : void 0,
361
+ hasThumbnail: false,
362
+ isProtected: true
363
+ });
335
364
  }
336
365
  }
337
366
  } catch {