zerodha / frappe-attachments-s3

A frappe app to upload file attachments in doctypes to s3.
Other
119 stars 136 forks source link

while migrating existing files #58

Open arvindkumar134 opened 1 year ago

arvindkumar134 commented 1 year ago

App Versions

{
    "communications": "0.0.1",
    "erpnext": "14.33.0",
    "ezygst": "0.0.1",
    "frappe": "14.40.1",
    "frappe_s3_attachment": "0.0.1",
    "hrms": "14.10.1",
    "india_compliance": "0.0.1",
    "m_pr": "0.0.1",
    "payments": "0.0.1",
    "reconciler": "0.0.1"
}

Route

Form/S3 File Attachment/S3 File Attachment

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 66, in application
    response = frappe.api.handle()
               ^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 47, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1608, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe_s3_attachment/frappe_s3_attachment/controller.py", line 322, in migrate_existing_files
    upload_existing_files_s3(file['name'], file['file_name'])
  File "apps/frappe_s3_attachment/frappe_s3_attachment/controller.py", line 275, in upload_existing_files_s3
    key = s3_upload.upload_files_to_s3_with_key(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe_s3_attachment/frappe_s3_attachment/controller.py", line 110, in upload_files_to_s3_with_key
    mime_type = magic.from_file(file_path, mime=True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/magic.py", line 153, in from_file
    return m.from_file(filename)
           ^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/magic.py", line 95, in from_file
    with open(filename):
         ^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './Frappe/private/files/HJFSZG76_Arvindtrail.txt'

Request Data

{
    "type": "POST",
    "args": {},
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe_s3_attachment.controller.migrate_existing_files"
}

Response Data

{
    "exception": "FileNotFoundError: [Errno 2] No such file or directory: './Frappe/private/files/HJFSZG76_Arvindtrail.txt'"
}
arvindkumar134 commented 1 year ago

how to ignore duplicates