Skip to content

Commit

Permalink
Throw exception when consecutive slashes detected in URL path
Browse files Browse the repository at this point in the history
S3 can tolerate consecutive slash in object key, such as "path//object"
but S3 will treat it different to "path/object".

User misconfiguration may result in excessive use of S3 storage space.
So detect and throw exception if consecutive slashes is detected in URL
path.
  • Loading branch information
orange-kao committed Nov 1, 2021
1 parent 5db2504 commit 4598602
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rpm_s3_mirror/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def __init__(self, base_url: str):
base_url += "/"
self.base_url = base_url
self.path = urlparse(base_url).path
if self.path.find("//") != -1:
raise ValueError("Consecutive slashes detected in URL path")
self.session = get_requests_session()

def has_updates(self, since: datetime) -> bool:
Expand Down

0 comments on commit 4598602

Please sign in to comment.