Skip to content

fix: strip trailing slash from LWC deploy path (#433)#442

Merged
msrivastav13 merged 1 commit into
masterfrom
fix/issue-433-trailing-slash
Jun 3, 2026
Merged

fix: strip trailing slash from LWC deploy path (#433)#442
msrivastav13 merged 1 commit into
masterfrom
fix/issue-433-trailing-slash

Conversation

@msrivastav13

Copy link
Copy Markdown
Owner

Closes the remaining part of #433.

Problem

After #435 fixed the EISDIR error, @jprichter reported that a directory path ending in a slash still failed:

sf deploy lwc -p force-app/main/default/lwc/ccdxSample/
Saving... Failed ✖
FIELD_INTEGRITY_EXCEPTION: Invalid fullName:

Root cause

_fileOrDirName = _path.substring(_path.lastIndexOf('/') + 1) returns an empty string when the path ends in /, so the bundle fullName is empty (Invalid fullName:) and the resource paths become lwc//<file>.

Fix

New normalizeFilePath service strips trailing path separators (/ and \) before the name is derived, while preserving a lone separator so the path never becomes empty. Applied to flags.filepath in deploy:lwc.

Testing

  • New unit tests in test/service/normalizeFilePath.test.ts (trailing slash, multiple slashes, Windows backslash, no-op cases, lone-separator guard).
  • npm test38 passing; npm run posttest clean.

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.
@msrivastav13 msrivastav13 merged commit 68f9e59 into master Jun 3, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant