Skip to content

[Bug]: File path separators (slashes) are handled inconsistently #181

Description

@thomaslaurenson

mpqcli version

0.10.2

Host OS

Linux

Installation method

Prebuilt binary

mpqcli command

mpqcli read 'scripts/foo.txt' archive.mpq

Expected behaviour

  • Forward slashes should work anywhere a file path inside an MPQ archive is accepted
  • mpqcli already converts / to \ when writing paths into an archive
  • It should accept the same input when looking them up

Actual behaviour / error output

$ mpqcli read 'scripts\foo.txt' proj.mpq
HELLO-NESTED

$ mpqcli read 'scripts/foo.txt' proj.mpq
[!] Failed: File doesn't exist for locale enUS: scripts/foo.txt

# But adding normalises fine
$ mpqcli add proj.mpq new.txt -p 'ui/panels/new.txt'
[+] Adding file: ui\panels\new.txt

Additional context

  • Split out of [Feature]: Update subcommands to be more consistent #180, which raised this alongside a separate subcommand-consistency problem
  • Paths going into an archive are normalised (add, create, rename new name)
  • Paths used to look up an existing file are not (remove, read, extract -f, rename old name)
  • rename fails on the old name while normalising the new one
  • Cause: StormLib defaults pfnHashString to HashStringSlash, which does not map / to \
  • Proposed rule: accept either separator on input, keep backslash as the canonical stored and displayed form.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions