File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 88import re
99import sys
1010import tempfile
11- import urllib .parse
12- from pathlib import Path
1311from typing import Iterator , List
1412
1513from specfile .exceptions import SpecfileException
@@ -117,9 +115,7 @@ def get_filename_from_location(location: str) -> str:
117115 Returns:
118116 Extracted filename that can be empty if there is none.
119117 """
120- url = urllib .parse .urlsplit (location )
121- if url .fragment :
122- if "/" in url .fragment :
123- return Path (url .fragment ).name .split ("=" )[- 1 ]
124- return Path (f"{ url .path } #{ url .fragment } " ).name
125- return Path (url .path ).name
118+ slash = location .rfind ("/" )
119+ if slash < 0 :
120+ return location
121+ return location [slash + 1 :].split ("=" )[- 1 ]
Original file line number Diff line number Diff line change 1111 [
1212 ("" , "" ),
1313 ("tarball-0.1.tar.gz" , "tarball-0.1.tar.gz" ),
14- ("https://example.com" , "" ),
14+ ("https://example.com" , "example.com" ),
15+ ("https://example.com#fragment" , "example.com#fragment" ),
1516 ("https://example.com/archive/tarball-0.1.tar.gz" , "tarball-0.1.tar.gz" ),
1617 (
1718 "https://example.com/archive/tarball-0.1.tar.gz#fragment" ,
You can’t perform that action at this time.
0 commit comments