fix: strip trailing slash from LWC deploy path (#433)#442
Merged
Conversation
A directory path ending in a slash (e.g. 'lwc/ccdxSample/') made the derived bundle name an empty string, producing 'FIELD_INTEGRITY_EXCEPTION: Invalid fullName:'. Normalize the input path by stripping trailing separators before deriving the name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the remaining part of #433.
Problem
After #435 fixed the
EISDIRerror, @jprichter reported that a directory path ending in a slash still failed:Root cause
_fileOrDirName = _path.substring(_path.lastIndexOf('/') + 1)returns an empty string when the path ends in/, so the bundlefullNameis empty (Invalid fullName:) and the resource paths becomelwc//<file>.Fix
New
normalizeFilePathservice strips trailing path separators (/and\) before the name is derived, while preserving a lone separator so the path never becomes empty. Applied toflags.filepathindeploy:lwc.Testing
test/service/normalizeFilePath.test.ts(trailing slash, multiple slashes, Windows backslash, no-op cases, lone-separator guard).npm test→ 38 passing;npm run posttestclean.