-
Notifications
You must be signed in to change notification settings - Fork 524
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
AO3-6719 Leave src URLs instead of emptiness for images stripped in AO3-6564 #4799
Merged
Merged
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
dcff6b5
AO3-6719 Test for exposed image src URLs
sarken f175655
AO3-6719 Replace img with src URL
sarken a3a14c0
AO3-6719 safety, not saftey
sarken 24b8dad
AO3-6719 Update regex
sarken ee755f4
AO3-6719 Update tests
sarken 6c49eba
AO3-6719 Make it work with single quotes just in case
sarken 9937bcf
AO3-6719 Control which types of comments have image safety mode enabl…
sarken 0e9ab80
AO3-6719 Remove outdated test that is covered elsewhere
sarken 6a7e0ed
AO3-6719 Use // instead of %r{} for regex
sarken 7bbcb67
AO3-6719 Make strip_images work when no src
sarken c838e91
AO3-6719 Make sure tests are returning something that resembles what …
sarken 575fc2e
AO3-6719 Test strip_images with a variety of img tags
sarken b5879e4
AO3-6719 Code style
sarken 552f16c
AO3-6719 Have we ever heard of committing the tests? No
sarken 6274010
AO3-6719 Add image-safety-mode to cache key
sarken 0a4e636
AO3-6719 Tidy, extend tests
sarken 02f84fc
AO3-6719 Update steps to ensure we're running the sanitizer
sarken b139016
AO3-6719 Use the HTML that breaks right for the tags too
sarken b96eee8
AO3-6719 Woof
sarken 424ce2e
AO3-6719 Remove a duplicate cuke, add a little more coverage in email…
sarken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Feature: Image safety mode | ||
In order to protect users | ||
As a site owner | ||
I'd like to control which comments can include images | ||
|
||
Scenario Outline: Images are embedded in comments when image safety mode is off. | ||
Given the setup for testing image safety mode on <commentable> | ||
And image safety mode is disabled for comments | ||
When I view <commentable> with comments | ||
Then I should see the image "src" text "https://example.com/image.jpg" | ||
And I should not see "OMG! https://example.com/image.jpg" | ||
When I go to the homepage | ||
Then I should see the image "src" text "https://example.com/image.jpg" | ||
And I should not see "OMG! https://example.com/image.jpg" | ||
When I go to my inbox page | ||
Then I should see the image "src" text "https://example.com/image.jpg" | ||
When image safety mode is enabled for comments on a "<parent_type>" | ||
And I view <commentable> with comments | ||
Then I should not see the image "src" text "https://example.com/image.jpg" | ||
But I should see "OMG! https://example.com/image.jpg" | ||
When I go to the homepage | ||
Then I should not see the image "src" text "https://example.com/image.jpg" | ||
But I should see "OMG! https://example.com/image.jpg" | ||
When I go to my inbox page | ||
Then I should not see the image "src" text "https://example.com/image.jpg" | ||
But I should see "OMG! https://example.com/image.jpg" | ||
|
||
Examples: | ||
| commentable | parent_type | | ||
| the admin post "Change Log" | AdminPost | | ||
| the work "My Opus" | Chapter | | ||
| the tag "No Fandom" | Tag | | ||
|
||
Scenario Outline: Embedded images in comments are replaced with their URLs when image safety mode is enabled. | ||
Given the setup for testing image safety mode on <commentable> | ||
And image safety mode is enabled for comments on a "<parent_type>" | ||
When I view <commentable> with comments | ||
Then I should not see the image "src" text "https://example.com/image.jpg" | ||
But I should see "OMG! https://example.com/image.jpg" | ||
When I go to the homepage | ||
Then I should not see the image "src" text "https://example.com/image.jpg" | ||
But I should see "OMG! https://example.com/image.jpg" | ||
When I go to my inbox page | ||
Then I should not see the image "src" text "https://example.com/image.jpg" | ||
But I should see "OMG! https://example.com/image.jpg" | ||
When image safety mode is disabled for comments | ||
And I view <commentable> with comments | ||
Then I should see the image "src" text "https://example.com/image.jpg" | ||
And I should not see "OMG! https://example.com/image.jpg" | ||
When I go to the homepage | ||
Then I should see the image "src" text "https://example.com/image.jpg" | ||
And I should not see "OMG! https://example.com/image.jpg" | ||
When I go to my inbox page | ||
Then I should see the image "src" text "https://example.com/image.jpg" | ||
And I should not see "OMG! https://example.com/image.jpg" | ||
|
||
Examples: | ||
| parent_type | commentable | | ||
| AdminPost | the admin post "Change Log" | | ||
| Chapter | the work "My Opus" | | ||
| Tag | the tag "No Fandom" | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The test added to add_comment.feature in #4729 can be removed, because this tests the same.