Skip to content

Conversation

@guidocella
Copy link
Contributor

@guidocella guidocella commented Oct 17, 2025

When the currently playing file is a URL, don't extract its basename, because the domain and path segments before the last are useful information.

Fixes half of #10975.

@github-actions
Copy link

@kasper93 kasper93 added this to the Release v0.41.0 milestone Oct 19, 2025
When the currently playing file is a URL, don't extract its basename,
because the domain and path segments before the last are useful
information.

Fixes half of mpv-player#10975.
guidocella added a commit to guidocella/mpv that referenced this pull request Nov 7, 2025
When the path is a URL, use the whole path as basename. The dirname will
be "." in this case.

This simplifies various checks throughout the codebase. In particular,
it avoids returning an empty string for URLs ending with /.

The filename property will return full URLs, which is desirable because
the domain and path segments before the last are useful information.
This fixes half of mpv-player#10975. The empty string check in
mp_property_filename() can be removed because it only happened with the
basename of URLs ending with /. mp_property_filename() will not be
called with directories with trailing slashes because mpv expands them
immediately when they are the current playlist entry; I tested it by
observing filename. Also mpv-player#16896 will prevent directories with trailing
slashes anyway.

This also fixes the issue described in mpv-player#17015 of %f in
--screenshot-template being evaluated to an empty string for URLs ending
with /, which can inadvertently make it use an absolute path.

Alternative to mpv-player#16932 and mpv-player#17021.
guidocella added a commit to guidocella/mpv that referenced this pull request Nov 7, 2025
When the path is a URL, use the whole path as basename. The dirname will
be "." in this case.

This simplifies various checks throughout the codebase. In particular,
it avoids returning an empty string for URLs ending with /.

The filename property will return full URLs, which is desirable because
the domain and path segments before the last are useful information.
This fixes half of mpv-player#10975.

This also fixes the issue described in mpv-player#17015 of %f in
--screenshot-template being evaluated to an empty string for URLs ending
with /, which can inadvertently make it use an absolute path.

Alternative to mpv-player#16932 and mpv-player#17021.
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