Skip to content

Commit b43d286

Browse files
cezarelnazliandreastt
authored andcommitted
py: check existence before creating a new directory
If the name ends with '/', check if the tmp directory already exists before trying to create it. Previously, it would result in an OSError exception being thrown. Signed-off-by: Andreas Tolfsen <[email protected]>
1 parent bc0cb2e commit b43d286

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: py/selenium/webdriver/firefox/firefox_profile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _install_extension(self, addon, unpack=True):
254254
tmpdir = tempfile.mkdtemp(suffix='.' + os.path.split(addon)[-1])
255255
compressed_file = zipfile.ZipFile(addon, 'r')
256256
for name in compressed_file.namelist():
257-
if name.endswith('/'):
257+
if name.endswith('/') and not os.path.isdir(os.path.join(tmpdir, name)):
258258
os.makedirs(os.path.join(tmpdir, name))
259259
else:
260260
if not os.path.isdir(os.path.dirname(os.path.join(tmpdir, name))):

0 commit comments

Comments
 (0)