Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move a file #25

Open
Xkonti opened this issue Aug 27, 2023 · 0 comments
Open

Move a file #25

Xkonti opened this issue Aug 27, 2023 · 0 comments
Labels
enhancement New feature or request hacktoberfest

Comments

@Xkonti
Copy link
Owner

Xkonti commented Aug 27, 2023

An endpoint that moves a specified file to a specified path. This can also cause renaming - it's an equivalent of Linux's mv command.

  • Verb: POST
  • Path: /file/move

Query parameters:

Name Value Default value Description
source string required A path to a file which should be moved.
destination string required A new path for the file.
overwrite true or false false Whether to overwrite if there already is a file at the destination path.

Responses:

  • 204 No Content - when the file was successfully moved.
  • 404 Not Found - when couldn't find the file or if the path is pointing to a directory.
  • 409 Conflict - when there already is a file at the destination path but overwrite is set to false.
  • 400 Bad Request - when the path is invalid or when the new path is invalid.

Extra info

The new path of the file should be also verified with isPathValid to make sure the outcome will be what user expects.

User can request to move file /docs/private/poetry.md to /docs/private/hidden/art.md. It means that:

  1. Directory hidden needs to be created.
  2. File poetry.md needs to be copied as art.md to the hidden directory.
  3. File poetry.md needs to be deleted.

If the overwrite is set to true and the destination points to an already existing file, it will be overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant