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

Upload scan to nextcloud #1068

Merged
merged 8 commits into from
Jan 17, 2025
Merged

Conversation

roemerm
Copy link
Contributor

@roemerm roemerm commented Jan 13, 2025

Hi,

thank you for your program. 😊

Because adding files to nextcloud via the file system is a bit complicated, I thought that uploading directly to a folder in nextcloud via API call might be easier.

Maybe others are also using nextcloud and now have a more direct way, if this PR is accepted.
I hope it will also work with ADF and/or platten multipage scan. Due to my device does not support this, I was unable to test it.

@roemerm roemerm force-pushed the feature/nextcloud-support branch 2 times, most recently from aef81eb to ec20d84 Compare January 13, 2025 14:52
@roemerm roemerm force-pushed the feature/nextcloud-support branch from ec20d84 to fe88dea Compare January 13, 2025 19:31
Copy link
Owner

@manuc66 manuc66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only read the code at this stage, I will test it too in the next days

@roemerm roemerm force-pushed the feature/nextcloud-support branch 4 times, most recently from a44e238 to 9b8a1ed Compare January 14, 2025 13:04
@manuc66
Copy link
Owner

manuc66 commented Jan 14, 2025

Tested on my self host nextcloud 30.0.4~ynh2

Pdf upload and image upload (platen multi file)

Thanks for this great contribution

@roemerm roemerm force-pushed the feature/nextcloud-support branch 2 times, most recently from cc0d601 to d696092 Compare January 15, 2025 17:06
@roemerm roemerm force-pushed the feature/nextcloud-support branch from d696092 to 15ed7e0 Compare January 15, 2025 17:06
@roemerm roemerm force-pushed the feature/nextcloud-support branch 3 times, most recently from 9c85a0e to 20dee2f Compare January 16, 2025 11:02
- Create test for exported nextcloud function; nextcloud reponses are
  mocked
- Skip file upload, if source file not exists
- distinguish uploaded file is created or updated
- extend logging. Different messages for "Folder not exists" and "User
  has no permission". Also log other errors
- Trim password in password file to remove trailing whitespaces
@roemerm roemerm force-pushed the feature/nextcloud-support branch from 20dee2f to 71be807 Compare January 17, 2025 10:44
@manuc66
Copy link
Owner

manuc66 commented Jan 17, 2025

@roemerm Please let me know when it's ready on your end so we can merge it with any improvements you'd like to make, if there are still any

@roemerm
Copy link
Contributor Author

roemerm commented Jan 17, 2025

Today I had a problem with line breaks in the password file. At the moment I have no further improvements on this in my mind. If so, I will open another PR.
If you don't have any comments, feel free to merge.

@manuc66 manuc66 merged commit 54a672e into manuc66:master Jan 17, 2025
2 of 4 checks passed
if (response.status === 201) {
action = "created";
} else {
action = "updated";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means you can lose documents because it could erase existing ones

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weil, actually not. Nextcloud updates an existing file. The last version is directly available in the (web) app. Nextcloud keeps the previous versions, which can be accessed from the web browser

action = "updated";
}
console.log(
`Document successfully ${action} file at Nextcloud. (Folder: ${uploadFolder}, File: ${fileName})`,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, had to read the sentence again to see that. 🙈

@roemerm roemerm deleted the feature/nextcloud-support branch January 19, 2025 16:30
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

Successfully merging this pull request may close these issues.

2 participants