Skip to content

Commit 0986866

Browse files
authored
Merge pull request readthedocs#5371 from rtfd/defensive-storage-uploads
Be more defensive with our storage uploading
2 parents 9dbf78a + 617c1d4 commit 0986866

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

readthedocs/builds/syncers.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,16 @@ def copy(cls, path, target, host, is_file=False, **kwargs): # pylint: disable=a
213213
any([target.lower().endswith(ext) for ext in cls.extensions]):
214214
log.info('Selective Copy %s to media storage', target)
215215

216-
storage_path = cls.get_storage_path(target)
216+
try:
217+
storage_path = cls.get_storage_path(target)
217218

218-
if storage.exists(storage_path):
219-
storage.delete(storage_path)
219+
if storage.exists(storage_path):
220+
storage.delete(storage_path)
220221

221-
with open(target, 'rb') as fd:
222-
storage.save(storage_path, fd)
222+
with open(target, 'rb') as fd:
223+
storage.save(storage_path, fd)
224+
except Exception:
225+
log.exception('Storage access failed for file. Not failing build.')
223226

224227

225228
class Syncer(SettingsOverrideObject):

0 commit comments

Comments
 (0)