Skip to content

fix(up): resolve relative deploy paths before bundling archive - #1375

Open
shafiktanbir wants to merge 1 commit into
railwayapp:masterfrom
shafiktanbir:fix/up-relative-path
Open

shafiktanbir wants to merge 1 commit into
railwayapp:masterfrom
shafiktanbir:fix/up-relative-path

Conversation

@shafiktanbir

Copy link
Copy Markdown

Fixes #1332

Summary

railway up <dir> failed with prefix not found when given a relative directory inside a linked project because get_deploy_paths passed the raw relative path as project_path while archive_prefix_path used the linked project's absolute directory. When create_deploy_tarball walked project_path, path.strip_prefix(archive_prefix_path) rejected the unaligned prefix.

Changes

  • Extract resolve_deploy_paths in src/commands/up.rs to resolve relative path arguments against the working directory and canonicalize both archive_prefix_path and project_path.
  • Validate that project_path stays within archive_prefix_path when --path-as-root is not set, returning an explicit error directing users to --path-as-root instead of failing inside tarball creation.
  • Add unit tests covering relative paths from project root and subdirectories, --path-as-root with a relative path, and out-of-project path rejection.

Verification

  • cargo fmt --all -- --check
  • cargo test commands::up::tests (4 passed)
  • cargo test controllers::upload::tests (6 passed)
  • cargo clippy --all-targets --all-features (0 warnings in src/commands/up.rs)

This branch has not been deployed

No deployments
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.

railway up with a relative directory always fails with "prefix not found"

1 participant