Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ Source Contributors
- Todd Roberts `@toddrob99 <https://github.com/toddrob99>`_
- MaybeNetwork `@MaybeNetwork <https://github.com/MaybeNetwork>`_
- Nick Kelly `@nickatnight <https://github.com/nickatnight>`_
- Yash Chhabria `@Cyatos <https://github.com/Cyatos>`_
- Gerard Rodes <GerardRodesVidal@gmail.com> `@GerardRodes <https://github.com/GerardRodes>`_
<!-- - Add "Name <email (optional)> and github profile link" above this line. -->
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Unreleased
**Fixed**

* An issue where leaving as a moderator fails if you are using token auth.
* An issue where an incorrect error was being raised due to invalid submission urls.
* A bug where if you call `.parent()` on a comment it clears its replies.
* An issue where performing a deepcopy on an :class:`.RedditBase` object will fail.
* Some cases where streams yield the same item multiple times. This cannot be
Expand Down
5 changes: 5 additions & 0 deletions asyncpraw/models/reddit/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,13 @@ def id_from_url(url: str) -> str:
raise InvalidURL(
url, message="Invalid URL (subreddit, not submission): {}"
)

elif "gallery" in parts:
submission_id = parts[parts.index("gallery") + 1]

elif parts[-1] == "comments":
raise InvalidURL(url, message="Invalid URL (submission id not present): {}")

else:
submission_id = parts[parts.index("comments") + 1]

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/models/reddit/test_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def test_id_from_url__invalid_urls(self):
"http://reddit.com/comments/_/2gmzqe",
"https://reddit.com/r/wallpapers/",
"https://reddit.com/r/wallpapers",
"https://www.reddit.com/r/test/comments/",
"https://reddit.com/comments/",
]
for url in urls:
with pytest.raises(ClientException):
Expand Down