Skip to content

Fix HTTP source playback on Windows#273

Merged
tedwaine merged 1 commit into
AcademySoftwareFoundation:developfrom
bdeluca:pr/fix-scan-posix-path-http
Jun 18, 2026
Merged

Fix HTTP source playback on Windows#273
tedwaine merged 1 commit into
AcademySoftwareFoundation:developfrom
bdeluca:pr/fix-scan-posix-path-http

Conversation

@bdeluca

@bdeluca bdeluca commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

scan_posix_path already has an http handler in its trailing else branch, but on Windows it was unreachable: fs::is_directory("http://…") throws std::filesystem_error ("The specified path is invalid"), the outer catch swallows it, and the function returns {} — the caller sees no media. Linux's POSIX stat() returns ENOENT instead, so the throwing overload returns false and execution falls through to the http handler. That's why the bug never showed up there.

Switch both fs::is_directory and fs::is_regular_file to the (path, error_code) overloads. They do the same syscall but report errors through error_code instead of throwing, so on Windows they return false for a URL string and the http handler is reached, matching Linux. Safe on Linux because the new overloads share their implementation with the throwing form.

Fixes HTTP source playback on Windows. scan_posix_path already has an
http handler in its trailing else branch, but on Windows it was
unreachable: fs::is_directory(p) for a string like
"http://host/path.mov" raises std::filesystem_error ("The specified
path is invalid"), the outer catch swallows it, and the function
returns an empty vector — the caller sees no media.

Linux behaves differently. POSIX stat() doesn't reject URL strings as
syntactically invalid; it just returns ENOENT. The throwing
fs::is_directory translates that into "return false, don't throw", so
execution falls through to the http handler. That's why the bug never
showed up there.

Switch both fs::is_directory(p) and fs::is_regular_file(p) to the
noexcept (path, error_code) overloads. They do the same syscall but
report errors through error_code instead of throwing — so on Windows
they return false for a URL string and execution reaches the http
handler, matching Linux. The error_code is intentionally unread: we
only care that the path isn't a local file or directory.

Safe on Linux because the new overloads share their implementation
with the throwing form — they're just a different way of surfacing
the same result. Real filesystem paths continue to be classified
identically.

Signed-off-by: Ben de Luca <bdeluca@gmail.com>
@tedwaine tedwaine merged commit 7b2ecee into AcademySoftwareFoundation:develop Jun 18, 2026
2 of 3 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.

2 participants