We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fc98294 + aac333a commit 6054f81Copy full SHA for 6054f81
netbox/core/models/files.py
@@ -88,19 +88,11 @@ def _resolve_root_path(self):
88
def sync_data(self):
89
if self.data_file:
90
self.file_path = os.path.basename(self.data_path)
91
- self._write_to_disk(self.full_path, overwrite=True)
92
93
- def _write_to_disk(self, path, overwrite=False):
94
- """
95
- Write the object's data to disk at the specified path
96
97
- # Check whether file already exists
98
- storage = self.storage
99
- if storage.exists(path) and not overwrite:
100
- raise FileExistsError()
+ storage = self.storage
101
102
- with storage.open(path, 'wb+') as new_file:
103
- new_file.write(self.data)
+ with storage.open(self.full_path, 'wb+') as new_file:
+ new_file.write(self.data_file.data)
104
105
@cached_property
106
def storage(self):
0 commit comments