librephotos icon indicating copy to clipboard operation
librephotos copied to clipboard

Unable to set NextCloud scan directory

Open servoronine opened this issue 2 years ago • 4 comments

I am unable to set up the NextCloud scan directory under "Library". The steps are as follows:

  1. I set the server host name, user name and password and save these settings: image
  2. I then click on "Not Set" under the credentials section. The app correctly displays my list of NextCloud storage folders. I then select my "Pictures" folder and click on "Update": image

Following these steps the folder is still showing as not set, so I am unable to scan: image

servoronine avatar Jun 14 '22 10:06 servoronine

I managed to get this working after having set the data directory via the UI. It seems a bit confusing as to why it did not pick one up from the docker environment file. Is the option in .env file obsolete?

servoronine avatar Jun 14 '22 13:06 servoronine

I'm seeing a similar issue in the 'dev' docker image, but I'm not actually able to select a nextcloud directory (although they are displayed). When i try to select a directory, it doesn't populate the directory name in the "Current Nextcloud scan directory" field.

meichthys avatar Jul 28 '22 13:07 meichthys

I am experiencing this issue as well.

Here's the information I can add:

When loading the /library path, there's a GET request happening, hitting a /api/nextcloud/listdir endpoint. However the server returns a 400 Bad Request status.

I see a corresponding console.error happening, logging the following object:

error logged in console
{
  "data": "",
  "status": 400,
  "statusText": "Bad Request",
  "headers": {
    "allow": "GET, HEAD, OPTIONS",
    "connection": "keep-alive",
    "content-length": "0",
    "date": "Sat, 13 Aug 2022 22:54:30 GMT",
    "referrer-policy": "same-origin",
    "server": "nginx/1.21.6",
    "vary": "Accept, Origin",
    "x-content-type-options": "nosniff",
    "x-frame-options": "DENY"
  },
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 30000,
    "xsrfCookieName": "csrftoken",
    "xsrfHeaderName": "X-CSRFToken",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {
      "FormData": null
    },
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Authorization": "Bearer ",
      "X-CSRFToken": ""
    },
    "baseURL": "/api/",
    "withCredentials": true,
    "method": "get",
    "url": "nextcloud/listdir/?fpath="
  },
  "request": {}
}

However, I still see a list of Nextcloud folders, however only the top level folders with the little triangles to fold out / open a folder missing, are listed there.

When clicking on one of the folders, the following error is logged in the browser console:

Uncaught TypeError: f.current.inputRef is undefined
    onClick ModalNextcloudScanDirectoryEdit.tsx:39
    onClick ModalNextcloudScanDirectoryEdit.tsx:100
    React 27
    notify Redux
    uu React
    Redux 4
    xE errorMiddleware.ts:36
    Redux 13
    call index.js:5
    call index.js:5
    E index.js:5
    e index.js:5
    v Redux
ModalNextcloudScanDirectoryEdit.tsx:39:4
    onClick ModalNextcloudScanDirectoryEdit.tsx:39
    onClick ModalNextcloudScanDirectoryEdit.tsx:100
    React 11
    bind_applyFunctionN self-hosted:1349
    Vt self-hosted:1312
    React 3
    forEach self-hosted:4326
    React 7
    lu self-hosted:1198
    React 6
    notify Redux
    uu React
    Redux 4
    xE errorMiddleware.ts:36
    Redux 13
    call index.js:5
    forEach self-hosted:164
    call index.js:5
    E index.js:5
    e index.js:5
    v Redux

I'm not sure whether the problems are related or not.

This happens with both the :latest and the :dev docker image as of writing this comment. I tested it with the latest version of nextcloud (24.0.4).

Sidenote: I am also seeing a few failed requests in the request log besides the 400 status on the /api/nextcloud/listdirendpoint:

grafik

esclear avatar Aug 13 '22 23:08 esclear

I'm having this issue as well. My librephotos is running on a Synology in Docker. I set the variables from the docker-compose.yml in the file itself, as I saw no way to add them anywhere else and so far everything works, except this problem. It is not even related to nextcloud, the issue stems from a 401 request on any API. Something is not working correctly in the Django Rest Framework. I'm getting a "message": "Authentication credentials were not provided." if I try to call any API, which is in accordance with my Synology-Docker logs. I get stuff like "Unauthorized: /api/albums/date/list/" or "Not Found: /api/jobs/" in the logs. Tried to dig through the code a little, but I barely know anything besides shell and it's kinda tough to make out the culprit in such a large project... Maybe someone has an idea how to fix this.

splattergamesextended avatar Aug 16 '22 19:08 splattergamesextended

I face the same issue. If Scan directory is not set by admin. you cannot set a nextcloud_scan_directory

The error returning is:

​​
responseText: "{\"errors\":[{\"field\":\"scan_directory\",\"message\":\"[ErrorDetail(string='This field may not be blank.', code='blank')]\"}]}"

from url:

responseURL: "https://****/api/user/7/"

if you help me understand where the request goes (into backend) then I can find the issue.

@derneuere adding you as mention here.

varet80 avatar Nov 29 '22 14:11 varet80