Skip to content

fix: replace hardcoded Windows path separators with os.sep (#34)#35

Merged
SeaCelo merged 1 commit intoEAPD-DRB:mac-portfrom
tejassinghbhati:feature/34-os-agnostic-paths
Feb 26, 2026
Merged

fix: replace hardcoded Windows path separators with os.sep (#34)#35
SeaCelo merged 1 commit intoEAPD-DRB:mac-portfrom
tejassinghbhati:feature/34-os-agnostic-paths

Conversation

@tejassinghbhati
Copy link
Copy Markdown
Contributor

Closes #34

Summary

Replaces all hardcoded Windows-style backslash path separators ('\\') with os.sep from the Python standard library in the S3 upload logic.

This is a non-breaking fix that advances the project's stated goal of platform-independence.


Changes

API/Classes/Base/SyncS3.py

  • uploadSync()
    • Default prefix parameter changed from '\\' to os.sep
  • uploadSync()
    • fileName.replace('\\', '/')fileName.replace(os.sep, '/')
  • updateSync()
    • localFile.replace('\\', '/')localFile.replace(os.sep, '/')

API/Routes/Upload/UploadRoute.py

  • upload_dir()
    • Default prefix parameter changed from '\\' to os.sep
  • upload_dir()
    • fileName.replace('\\', '/')fileName.replace(os.sep, '/')

Notes

  • os is already imported in both files — zero new dependencies introduced.
  • os.sep evaluates to '\\' on Windows, so existing Windows behaviour is completely unchanged.
  • On macOS and Linux, os.sep correctly evaluates to '/', fixing silent failures in S3 path construction on those platforms.
  • Directly addresses the constraint listed in docs/ARCHITECTURE.md:

"Hardcoded or relative path assumptions exist and reduce portability."


Testing

  • Verified that os.sep resolves to '\\' on Windows (behaviour preserved).
  • Verified that logic using startswith(prefix) and replace(prefix, "", 1) behaves identically when prefix=os.sep.
  • Confirmed correct S3 key generation on macOS/Linux environments.
  • Confirmed no regression in existing upload functionality.

@SeaCelo SeaCelo changed the base branch from main to mac-port February 25, 2026 17:51
@SeaCelo
Copy link
Copy Markdown
Collaborator

SeaCelo commented Feb 25, 2026

Retargeted to mac-port per the macOS integration track: #51.
We are validating Mac/cross-platform changes in mac-port first, then merging mac-port -> main.

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.

[Task] Refactor hardcoded Windows path separators in UploadRoute and SyncS3 to use os.sep

2 participants