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

Improve legacy photo post special handling #167

Merged
merged 5 commits into from
Aug 18, 2023

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Aug 16, 2023

Legacy photo posts require some special handling. Improve matching logic for legacy photo posts.

@sirreal sirreal temporarily deployed to integration-suite August 16, 2023 13:06 — with GitHub Actions Inactive
@sirreal sirreal requested a review from straku August 16, 2023 13:09
lib/tumblr.js Outdated
pathParts[2].toLowerCase() === 'blog' &&
pathParts[4].toLowerCase() === 'post' &&
// Make sure there's nothing after optional trailing `/`
!pathParts[5];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor feedback: I scratched my head a little bit over the last condition. It's smart, but maybe we could simplify it by normalizing pathname (making sure that the one that we analyze doesn't have trailing /) before doing the checks?

const pathname = url.pathname.endsWith('/') ? url.pathname.slice(0, -1) : url.pathname;
const pathParts = pathname.split('/');
...

@sirreal sirreal temporarily deployed to integration-suite August 18, 2023 12:22 — with GitHub Actions Inactive
@sirreal sirreal merged commit 926edfb into main Aug 18, 2023
7 checks passed
@sirreal sirreal deleted the improve-legacy-photo-post-match branch August 18, 2023 12:24
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