@W-21000456 [Version Retrieve] [CLI] Package Version Retrieve: folder-meta.xml files not extracted from developer zips#1679
Conversation
|
@ravipanguluri , this looks good to me. I'll do some QA on it, let you know if I have any problems, and if not then I'll approve and merge it. Expect that within the next few hours. |
src/resolve/metadataResolver.ts
Outdated
| // e.g., `/reports/` and if it does return that folder name. | ||
| folderContentTypesDirs.some((dirName) => { | ||
| if (fsPath.includes(`${sep}${dirName}${sep}`)) { | ||
| if (parts.includes(dirName)) { |
There was a problem hiding this comment.
Question: Do you need to have this be parts.slice(0, -1) so that it excludes the final part of the path and therefore guarantees that it's a folder that's being matched and not a file?
There was a problem hiding this comment.
I think you're right about this. I'll quickly test this out though. Although, this would only really get hit if the file was named exactly the same thing as the dirName with no file extension, which seems pretty unlikely.
jfeingold35
left a comment
There was a problem hiding this comment.
Approved pending the .slice usage discussed in feedback.
What does this PR do?
This PR updates the Metadata Resolver to find metadata with paths that have no leading separators. We uncovered this issue when customers with folders that contain reports we're trying to retrieve their metadata for their move to 2GP. An sf package version retrieve would give users the report, but it would not retrieve the folder itself. This is because the folder metadata file does not have a leading separator. I change the resolution logic to check the pre-split parts of the path instead of trying to match directly on the path.
What issues does this PR fix or reference?
@W-21000456@
Repo steps: create a package with a folder and put a report in the folder. Add metadata into a 1GP package and convert to 2GP. Run sf package version retrieve.
Functionality Before
Currently, you'll only retrieve the report metadata which lives inside the folder.
Functionality After
You'll retrieve both the folder and report metadata.