Git Product home page Git Product logo

cloud_storage's People

Contributors

agritheory avatar alchez avatar hkuz avatar myuddinkhatri avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud_storage's Issues

Modify default S3 path strategy

The use case for making a date/doctype/docname flavor of S3 path has multiple issues:

  • Verbose
  • Makes less sense in the context of the file association features
  • Makes paths more guessable (employee/employee_id/contract.pdf)
  • Nobody is or really should be using the S3/Spaces UI to browse files

Switch to using the name of the File record

Allow configuration of file path with a hookable function in case there's a customer reason to customize this (for example an FTP integration)

Make time expiry configurable

The time expiry feature should be configurable

  • Public files shouldn't expire
  • Private files should have a time expiry period that is pulled from site_config

Shorten outward-facing API paths

# hooks.py
override_whitelisted_methods = {
	"share": "cloud_storage.cloud_storage.overrides.file.share?key={path}",
	"retrieve": "cloud_storage.cloud_storage.overrides.file.retrieve?key={path}",
}

Also refactor

Documentation Checklist

For a ready to publish app, we want to have ready

  • Configuration guide
  • Amazon S3 setup
  • Digital Ocean Setup
  • Developer setup / contributing

Error while sending emails with attachments

Traceback:

If you test sending emails with an attachment, you get the following error:

FileNotFoundError: [Errno 2] No such file or directory: '/api/method/retrieve?key=attachments-new/Task/20230410 PO Report/xzCckWS.png'
  File "frappe/utils/background_jobs.py", line 160, in execute_job
    method(**kwargs)
  File "frappe/email/doctype/email_queue/email_queue.py", line 183, in send_mail
    record.send(is_background_task=is_background_task, smtp_server_instance=smtp_server_instance)
  File "frappe/email/doctype/email_queue/email_queue.py", line 134, in send
    message = ctx.build_message(recipient.recipient)
  File "frappe/email/doctype/email_queue/email_queue.py", line 293, in build_message
    message = self.include_attachments(message)
  File "frappe/email/doctype/email_queue/email_queue.py", line 348, in include_attachments
    fcontent = _file.get_content()
  File "frappe/core/doctype/file/file.py", line 441, in get_content
    with open(file_path, mode="rb") as f:

Context:

Initially, attachments can be viewed normally by clicking on their links in the top-left Attachments section.

After trying to send one of them via email, clicking on the attachment link again generates this error:

image

Create Version 15 branch

  • Bump required versions in pyproject.toml and package.json
  • Update release / CI with branch name

More Assumptions for `has_permission`

https://github.com/agritheory/cloud_storage/blob/version-14/cloud_storage/cloud_storage/overrides/file.py#L32

Shared With case:
We want to add another if block here to check if the file itself has been shared with anyone and to validate that with frappe.session.user.

Folder Shared With case:
Check if the parent folder has been explicitly shared with frappe.session.user. If there are no shared_with users, recursively check the parent folder until a shared_with value is found, and if frappe.session.user is present, otherwise deny.

File Version Control

Goal: Allow version control of files using Frappe and a cloud storage platform

Variables:

  • File Name: non-unique name assigned to a file object
  • Content Hash: unique content identifier for the file object

Flows

1. New filename, new hash

  1. User uploads a file
  2. Client makes a call to Frappe server to validate duplicate name and/or hash
  3. No file with filename or hash exists
  4. Continue file upload process and store in cloud platform
  5. Retrieve (if not available in response) and store the file's version ID (if applicable)

2. Existing filename, new hash

  1. User uploads a file
  2. Client makes a call to Frappe server to validate duplicate name and/or hash
  3. A file with the same filename is found, but with different hash
  4. Ask user for an input (create new file with new name, or override existing file and add version):
  • If new file:
    • Continue file upload process and store in cloud platform
    • Retrieve (if not available in response) and store the file's version ID (if applicable)
  • If override:
    • Continue file upload process and override the file object in the cloud platform
    • Retrieve (if not available in response) and store the file's new version ID (if applicable)

Rename-Replace


3&4. New/existing filename, existing hash

  1. User uploads a file
  2. Client makes a call to Frappe server to validate duplicate name and/or hash
  3. A file with the same unique hash is found, with the same or different file name
  4. Stop file upload process and show a link to the existing file

View-Exit


5. Rename file

  1. User clicks on "Rename" on a File record via the UI
  2. Client makes a call to Frappe server to validate duplicate name
  • If new filename is available:
    • Continue rename process and change name on cloud platform
    • Retrieve (if not available in response) and store the file's new version ID (if applicable)
  • If new filename exists:
    • Ask user for an input (new filename)
    • Continue rename process and change name on cloud platform
    • Retrieve (if not available in response) and store the file's new version ID (if applicable)

File Manager

Sharing Links

Using a separate API, generate a sharing link for files, that subsequently calls the retrieve API.

File Drop Portal

Allow logged in users and/or sharing link/token pair to file drop via portal - needs to be configurable

The automated release is failing 🚨

🚨 The automated release from the version-14 branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the version-14 branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

CI Checklist

  • Validate JSON and Python Syntax example
  • Black (frappe/black) + precommit
  • mypy
  • Prettier (use stonecrop config) + precommit
  • Unit tests
  • Semantic Release

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.