Open
Description
Is user directly tries to upload the File without being attached to any doctype, then it gives error Stack Trace -
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 97, in application
response = frappe.api.handle()
File "apps/frappe/frappe/api.py", line 55, in handle
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 48, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1619, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/handler.py", line 229, in upload_file
return frappe.get_doc(
File "apps/frappe/frappe/model/document.py", line 310, in save
return self._save(*args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 332, in _save
return self.insert()
File "apps/frappe/frappe/model/document.py", line 259, in insert
self.run_method("before_insert")
File "apps/frappe/frappe/model/document.py", line 931, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 1283, in composer
return composed(self, method, *args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 1265, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "apps/frappe/frappe/model/document.py", line 928, in fn
return method_object(*args, **kwargs)
File "apps/frappe/frappe/core/doctype/file/file.py", line 72, in before_insert
self.save_file(content=self.get_content())
File "apps/frappe/frappe/core/doctype/file/file.py", line 604, in save_file
return write_file_method(self)
File "apps/cloud_storage/cloud_storage/cloud_storage/overrides/file.py", line 490, in write_file
return upload_file(file)
File "apps/cloud_storage/cloud_storage/cloud_storage/overrides/file.py", line 407, in upload_file
path = get_file_path(file, client.folder)
File "apps/cloud_storage/cloud_storage/cloud_storage/overrides/file.py", line 430, in get_file_path
file.attached_to_name.replace("#", "%23"),
AttributeError: 'NoneType' object has no attribute 'replace'
As the file is not attached to document and it tries to do file.attached_to_name.replace("#", "%23")
Metadata
Metadata
Assignees
Labels
No labels