Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testharness.js] Fix issue caused when path contains full stop characters (.) #50695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johannesodland
Copy link
Contributor

#50693

The current implementation of get_title() assumes that the path does not contain a full stop character. If it does, get_title() would return parts of the path, in stead of the filename. The pathname /a.path/filename.html would cause get_title() to return .path instead of the expected filename.

This change fixes the issue by trimming the path away before searching for the extension. It maintains the current behavior, where it only keeps the first part of the filename if the filename contains multiple full stop characters. /path/filename.foo.html still causes filename to be returned.

Copy link
Contributor

@Ms2ger Ms2ger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible. Can we test for this?

@johannesodland
Copy link
Contributor Author

Seems sensible. Can we test for this?

That should be possible. I’ll add a test to this PR over the weekend.

…ters (.)

web-platform-tests#50693

The current implementation of `get_title()` assumes that the path does not contain a full stop character.
If it does, `get_title()` would return parts of the path, in stead of the filename.
The pathname `/a.path/filename.html` would cause `get_title()` to return `.path` instead of the expected `filename`.

This change fixes the issue by trimming the path away before searching for the extension.
It maintains the current behavior, where it only keeps the first part of the filename if the filename contains multiple full stop characters.
`/path/filename.foo.html` still returns `filename`.
@johannesodland johannesodland force-pushed the return-filename-when-path-contains-full-stop branch from d23a849 to d298c10 Compare February 15, 2025 18:32
@johannesodland
Copy link
Contributor Author

Added a test to assert that get_title() returns the file name and does not return parts of the path.

https://github.com/web-platform-tests/wpt/compare/d23a849cd3494440b223c32e74b1739215860677..d298c10c32e85d04670b44a3fc2b19df2375f57d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants