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

Sending to existing subfolder #9

Closed
lumpiluk opened this issue Nov 11, 2021 · 4 comments
Closed

Sending to existing subfolder #9

lumpiluk opened this issue Nov 11, 2021 · 4 comments

Comments

@lumpiluk
Copy link

lumpiluk commented Nov 11, 2021

Trying to upload to an existing subfolder, I get the following error and the contradictory message that Curl exited without errors.
Omitting the ? and everything after it lets me upload the test file to the root of the shared folder without errors.
Is there already a method to upload to subfolders that I am missing?

> ./cloudsend ~/test.csv "https://cloud.url/s/sometoken?path=%2FPhotos%20%2B%20Videos%2FSubfolder"                                                                                                 Thu Nov 11 14:24:50 2021
Tavinus Cloud Sender v2.2.1


SENDING SINGLE FILE
===================

test.csv > 
######################################################################### 100.0%
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
  <s:message>Username or password was incorrect</s:message>
</d:error>

SUMMARY
=======

 > All Curl calls exited without errors
 > Attempt to send completed > test.csv
@tavinus
Copy link
Owner

tavinus commented Nov 11, 2021

Hi. That seems to be correct.

In this case curl exited without any errors indeed. This means curl was able to perform the request and get an answer without any errors. However, you got an error in your call, which is described in the response xml. So, if you get ANY response (even an error response) curl exited without errors.

From the message, it seems like you didn't provide the needed authentication for this shared folder (password?). Or maybe the URL is invalid because you appended the folder into it. The share URL is static. I don't think you can change it to include an inner folder. You can share the inner folder by itself (get another link) or maybe you can send the parent folder with the same name (you may get an error that the folder already exists, I don't remember how it behaves).

In any case, the share URL is always exactly the link nextcloud provides. You cannot append folders into the share link URL. You may try to send a folder, but the target is always the root of the share URL.

Let me know how that goes.

Cheers!
Gus

@tavinus
Copy link
Owner

tavinus commented Nov 12, 2021

Ok, I just tested the "https://cloud.url/s/sometoken?path=MYFOLDER" and it actually opens the sub folder (in the browser).

This means it can be possible to do what you want, but that is not implemented.

Things to note:

  • The username is the token, so we need to break it from the url parameter (?path=...)
  • After the successful login with token/password, we need to change dir to the target dir
  • The target dir may not exist (how do we test and account for errors?)
  • Still need to test what happens if we send a folder with the same name to the root of the share (may work)

I am setting a new system to myself at the moment. Still setting up the environment.

I think I can filter for path= in the url and get to work as you want, bear with me tho...

@tavinus tavinus closed this as completed in 901a339 Nov 4, 2022
@tavinus
Copy link
Owner

tavinus commented Nov 4, 2022

Hi @lumpiluk , coul you please try version 2.2.5 and confirm it fixes your problem?

v2.2.5
Allows sending files and folders to a secondary folder that is inside a shared folder (or its siblings).

The folder link must follow Nextcloud's notation, with ?path=%2FFOLDERNAME added to the link.

The easiest way is to open the shared folder from the shared link and then copy the URL.

Example of a valid URL:

https://cloud.mydomain.tld/s/TxWdsNX2Ln3X5kxG?path=%2FMYFOLDER

tavinus added a commit that referenced this issue Nov 5, 2022
This version allows sending files to sub-folders inside the main shared folder.   
  
The folder link must follow Nextcloud's notation, with `?path=%2FFOLDERNAME` appended to the link.  
  
The easiest way is to open the shared folder from the shared link and then copy the URL.  
  
Example of a valid URL:  
```
https://cloud.mydomain.tld/s/TxWdsNX2Ln3X5kxG?path=%2FMYFOLDER

Fixes #9
@tavinus
Copy link
Owner

tavinus commented Jul 18, 2024

Just to register that version 2.3.2 adds a --target option for setting a base folder.
It will create the folder tree if needed and perform all operations inside it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants