Skip to content

Commit

Permalink
Add parsing to auto add / for MFS paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsmedley committed Sep 17, 2024
1 parent 730ddba commit ec4f39a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/objectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ObjectManager {
* // Upload Directory
* await objectManager.upload("my-first-directory", [
* {
* path: "/testObjects/1.txt",
* path: "/testObjects/1.txt", // Virtual Path to store contents at within IPFS Folder/Directory
* content: Buffer.from("upload test object", "utf-8"),
* },
* {
Expand Down Expand Up @@ -212,8 +212,9 @@ class ObjectManager {
}
const task = (async () => {
await queue.add(async () => {
const mfsPath = entry.path.startsWith('/') ? entry.path : `/${entry.path}`;
uploadLogger.silly("SOURCE_IMPORT_STARTED", {
path: entry.path,
path: mfsPath,
size: queue.size,
});

Expand Down Expand Up @@ -247,9 +248,9 @@ class ObjectManager {
} else {
return;
}
createdFiles.set(entry.path, createdFile);
createdFiles.set(mfsPath, createdFile);
uploadLogger.verbose("SOURCE_IMPORT_COMPLETED", {
path: entry.path,
path: mfsPath,
size: queue.size,
});
} else {
Expand All @@ -261,9 +262,9 @@ class ObjectManager {
} else {
return;
}
createdFiles.set(entry.path, createdFile);
createdFiles.set(mfsPath, createdFile);
uploadLogger.verbose("SOURCE_IMPORT_COMPLETED", {
path: entry.path,
path: mfsPath,
size: queue.size,
});
}
Expand Down

0 comments on commit ec4f39a

Please sign in to comment.