Skip to content

Commit

Permalink
expose displayPath when needed or possible
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Apr 30, 2024
1 parent da9604d commit 21596a7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuclia-sync-agent-app",
"version": "1.4.1",
"version": "1.4.2",
"description": "This is a Nuclia Sync Agent App",
"main": "build/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.4.2 (2024-04-30)

- When loading folders, expose `displayPath` when needed and possible, according the connector types.

# 1.4.1 (2024-04-30)

- Fix titles in sitemap and RSS connectors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,28 @@ export class GDriveImpl extends OAuthBaseConnector implements IConnector {
if (!folderId) {
return [];
}
let path: string[] = [];
let path: { id: string; title: string }[] = [];
let currentFolder = getFolder(folderId);
while (currentFolder) {
path = [currentFolder.title, ...path];
path = [{ id: currentFolder.originalId, title: currentFolder.title }, ...path];
if (!parents[currentFolder.originalId]) {
break;
}
currentFolder = getFolder(parents[currentFolder.originalId]);
}
return path;
};
const foldersWithPath = folders.map((folder) => ({
...folder,
metadata: {
...folder.metadata,
path: ['', ...getFolderPath(folder.parents?.[0]), folder.title].join('/'),
},
}));
const foldersWithPath = folders.map((folder) => {
const folderPathData = getFolderPath(folder.parents?.[0]);
return {
...folder,
metadata: {
...folder.metadata,
path: ['', ...folderPathData.map((f) => f.id), folder.originalId].join('/'),
displayPath: ['', ...folderPathData.map((f) => f.title), folder.title].join('/'),
},
};
});
return {
...results,
items: foldersWithPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ export class OneDriveImpl extends OAuthBaseConnector implements IConnector {
title: item.name,
originalId: item.id,
metadata: {
path: `${item.parentReference.path}/${item.name}`,
path: `${item.parentReference.path}/${item.id}`,
displayPath: `${item.parentReference.path}/${item.name}`,
},
status: FileStatus.PENDING,
};
Expand Down

0 comments on commit 21596a7

Please sign in to comment.