Skip to content

Commit 8632ee6

Browse files
committed
fix: lastIndexOf handles foo/lwc/foo
1 parent 3d5bb05 commit 8632ee6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shared/metadataKeys.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getMetadataKey } from './functions';
1212
// LWC can have child folders (ex: dynamic templates like /templates/noDataIllustration.html
1313
const pathAfterFullName = (fileResponse: RemoteSyncInput): string =>
1414
fileResponse && fileResponse.filePath
15-
? fileResponse.filePath.substr(fileResponse.filePath.indexOf(fileResponse.fullName)).replace(/\\/gi, '/')
15+
? fileResponse.filePath.substr(fileResponse.filePath.lastIndexOf(fileResponse.fullName)).replace(/\\/gi, '/')
1616
: '';
1717

1818
const registry = new RegistryAccess();
@@ -30,7 +30,7 @@ export const getMetadataKeyFromFileResponse = (fileResponse: RemoteSyncInput): s
3030
// also create an element for the parent object
3131
if (fileResponse.type === 'CustomField' && fileResponse.filePath) {
3232
const splits = path.normalize(fileResponse.filePath).split(path.sep);
33-
const objectFolderIndex = splits.indexOf('objects');
33+
const objectFolderIndex = splits.lastIndexOf('objects');
3434
return [
3535
getMetadataKey('CustomObject', splits[objectFolderIndex + 1]),
3636
getMetadataKey(fileResponse.type, fileResponse.fullName),

0 commit comments

Comments
 (0)