-
Notifications
You must be signed in to change notification settings - Fork 36
Always show fullsize imgur images #209
Always show fullsize imgur images #209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check whether there are tests in UrlParser, and if it would be possible to add new tests for your changes?
It’s not a requirement but would be nice to have.
// Strip any preview-related suffixes and queries | ||
imageUrl = imageUrl.newBuilder() | ||
.encodedQuery(null) | ||
.encodedPath(imgurPreviewPat.matcher(imageUrlPath).replaceFirst(".")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably won’t occur but what if that pattern was found earlier than before extension? Maybe it’s better to replace last occurrence instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using java's matcher this can only be done by a more precise regex. Something like s/_d(\.\w+)$/$1/
yes, I'll add test cases for this |
b5e382d
to
46cfbb6
Compare
that should do it |
Great, thanks. |
By the way, maybe it worth to add |
Sounds like a good idea for improvement. |
When submission contains direct imgur url sometimes Dawn were loading preview images.
_d
filename suffix and .webp extension both required to reproduce this. I've added webp as image format and also added stripping of_d
just to be safe