Skip to content

Port upstream #207: a media share is refused however it is spelled - #49

Merged
DesertGamer merged 1 commit into
DesertGamer:mainfrom
lcg007xd-c:port/upstream-207-media-share-spellings
Nov 26, 2026
Merged

DesertGamer merged 1 commit into
DesertGamer:mainfrom
lcg007xd-c:port/upstream-207-media-share-spellings

Conversation

@lcg007xd-c

Copy link
Copy Markdown
Contributor

What this changes

This ports Marvisak/VIctory#207 by Maraco91. It is cherry-picked with -x, so the commit keeps their authorship.

The media source resolver in crates/viport-hle/src/modules/media.rs serves local files only. A network share must be refused before it reaches the host's Media Foundation resolver. local recognises a share only when it is spelled \\.., //.. or file://server/...

The host accepts more spellings:

  • any two leading separators (/\server\share, \/server/share);
  • the object manager's prefix (\??\UNC\server\share);
  • a file: URL with no host whose path starts with two separators (file:////server/share, file:\\server\share), also percent-encoded (file:///%5C%5Cserver/share).

All of these pass through as relative or drive-less local paths and reach the host's resolver unchanged.

After this change they are refused, naming the server, like the spellings already caught. Still accepted as before: paths with one leading separator, a drive after the slashes or after the prefix, and the path of a URL that names this machine.

VIPort has the upstream merge of #207 in its history, but the change is not in the tree. It was lost in a later merge. The code applied cleanly. The only conflict was in the test module: VIPort's two URL entry point tests are kept, and #207's tests follow them.

Checked

  • No game data of any kind (files, extracts, screenshots, dumps, saves): see docs/asset-policy.md
  • No binary files or archives
  • No new dependency, build.rs, git hook, .cargo config, CI change or script (or an issue explains why)
  • No download, no started program, no network connection added (or an issue explains why). This refuses more network paths; it adds no access.
  • cargo test --workspace passes (not run, see below)
  • cargo clippy --workspace --all-targets --locked -- -D warnings passes (Windows target, run on Linux)
  • The code I wrote is formatted with rustfmt; I did not reformat lines I did not change

What I ran

On Linux, I compiled local and percent_decode from main and from this branch side by side with shares_are_refused_however_they_are_spelled. files::translate was stubbed out, since it only maps virtual drives.

  • main: fails on the first spelling:
    /\server\share\a.mp4
    left:  Ok("/\\server\\share\\a.mp4")
    right: Err(("unc", "server"))
    
  • This branch: passes.

cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: clean.

Not run: cargo test -p viport-hle, which builds only for Windows. This includes #207's #[cfg(windows)] test, which checks what the host makes of each spelling. The Windows CI test step will run it.

Overlaps

None. No open PR touches viport-hle/src/modules/media.rs.

🤖 Generated with Claude Code

The source resolver's rule (local files only) knew a share as `\..`,
`//..` or `file://server/..`. The host knows more spellings: any two
leading separators (`/\server\share`), the object manager's prefix
(`\??\UNC\server\share`), and a `file:` URL with no host whose path
starts with two separators (`file:////server/share`,
`file:\server\share`, also percent-encoded). Those fell through as
relative paths or drive-less local files and went to the host's
resolver unchanged.

They are refused now, naming the server. Paths with one leading
separator, a drive after the slashes or the prefix, and the path of a
URL that names this machine pass as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 11ca3ce)
@DesertGamer
DesertGamer merged commit 90a344c into DesertGamer:main Nov 26, 2026
1 check 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.

3 participants