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

Better handling of URLs without trailing slash #24

Merged
merged 3 commits into from
Jan 5, 2021
Merged

Conversation

chosak
Copy link
Member

@chosak chosak commented Jan 4, 2021

The current logic assumes that all URLs will end in a slash and thus generate report JSON files that look like URL_-TIMESTAMP.report.json. URLs that don't have a slash don't include that underscore, which breaks the create-report-index script (as reported on #22).

This commit modifies the report cord so that a URL's trailing slash is included in its report URL. This will impact live URLs, meaning that instead of pages like

https://cfpb.github.io/cfgov-lighthouse/www_consumerfinance_gov-_about_us_blog/

we'll have URLs like

https://cfpb.github.io/cfgov-lighthouse/www_consumerfinance_gov-_about_us_blog_/

(note the added trailing underscore).

This is probably more correct to account for hypothetical cases where you have two URLs that differ depending on the trailing slash.

I've also deleted report HTML files that will be renamed due to this change; I wonder if we should add a step that cleans the output HTML directory as part of the build to avoid having to do this?

@chosak
Copy link
Member Author

chosak commented Jan 4, 2021

I'll fix the tests.

The current logic assumes that all URLs will end in a slash and thus
generate report JSON files that look like URL_-TIMESTAMP.report.json.
URLs that don't have a slash don't include that underscore, which breaks
the create-report-index script (as reported on issue 22).

This commit modifies the report core so that a URL's trailing slash is
included in its report URL. This will impact live URLs, meaning that
instead of pages like

https://cfpb.github.io/cfgov-lighthouse/www_consumerfinance_gov-_about_us_blog/

we'll have URLs like

https://cfpb.github.io/cfgov-lighthouse/www_consumerfinance_gov-_about_us_blog_/

(note the added trailing slash).

This is probably more correct to account for hypothetical cases where
you have two URLs that differ depending on the trailing slash.
@chosak chosak merged commit 43b2578 into main Jan 5, 2021
@chosak chosak deleted the fix/trailing-slash branch January 5, 2021 17:26
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.

None yet

2 participants