From 3f5b26bb488c19f291856d41f3f4c3289dc8f2cc Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 9 Mar 2013 01:20:52 -0800 Subject: [PATCH] Check if url starts with subreddit path before adding. Fixes add_sr behavior for multi URLs. --- r2/r2/lib/utils/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r2/r2/lib/utils/utils.py b/r2/r2/lib/utils/utils.py index 8fe52ac50..049b70ea3 100644 --- a/r2/r2/lib/utils/utils.py +++ b/r2/r2/lib/utils/utils.py @@ -574,7 +574,8 @@ class UrlParser(object): Adds the subreddit's path to the path if another subreddit's prefix is not already present. """ - if not self.path_has_subreddit(): + if not (self.path_has_subreddit() + or self.path.startswith(subreddit.path)): self.path = (subreddit.path + self.path) return self