Title: "Principal name not found" error on downloading a file · Issue #68 · a-schild/nextcloud-java-api · GitHub
Open Graph Title: "Principal name not found" error on downloading a file · Issue #68 · a-schild/nextcloud-java-api
X Title: "Principal name not found" error on downloading a file · Issue #68 · a-schild/nextcloud-java-api
Description: I am trying to download a file from Nextcloud (self-hosted, version is 20.0.8.1). The top level view in Nextcloud has a file "Nextcloud.mp4". I have verified that the username and password is correct (got a 401 error when I used the wron...
Open Graph Description: I am trying to download a file from Nextcloud (self-hosted, version is 20.0.8.1). The top level view in Nextcloud has a file "Nextcloud.mp4". I have verified that the username and password is corre...
X Description: I am trying to download a file from Nextcloud (self-hosted, version is 20.0.8.1). The top level view in Nextcloud has a file "Nextcloud.mp4". I have verified that the username and passwor...
Opengraph URL: https://github.com/a-schild/nextcloud-java-api/issues/68
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Principal name not found\" error on downloading a file","articleBody":"I am trying to download a file from Nextcloud (self-hosted, version is 20.0.8.1). The top level view in Nextcloud has a file \"Nextcloud.mp4\". I have verified that the username and password is correct (got a 401 error when I used the wrong password). I have also tried other methods without success (see the commented lines).\r\n\r\nHere is my code:\r\n```\r\n try {\r\n NextcloudConnector nc = new NextcloudConnector(\"nextcloud.example.com\", true, 443, \"my.name@example.com\", \"mypassword\");\r\n InputStream file = nc.downloadFile(\"/Nextcloud.mp4\");\r\n //nc.createFolder(\"/Test\");\r\n //List fileNames = nc.listFolderContent(\"/\");\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n```\r\nAnd here is the log file output:\r\n```\r\n09:50:31.858 [main] DEBUG org.apache.http.headers - http-outgoing-1 \u003e\u003e GET /remote.php/dav/files/my.name@example.com/Nextcloud.mp4/ HTTP/1.1\r\n09:50:31.858 [main] DEBUG org.apache.http.headers - http-outgoing-1 \u003e\u003e Host: nextcloud.example.com:443\r\n09:50:31.858 [main] DEBUG org.apache.http.headers - http-outgoing-1 \u003e\u003e Connection: Keep-Alive\r\n09:50:31.858 [main] DEBUG org.apache.http.headers - http-outgoing-1 \u003e\u003e User-Agent: Sardine/5.10\r\n09:50:31.858 [main] DEBUG org.apache.http.headers - http-outgoing-1 \u003e\u003e Accept-Encoding: gzip,deflate\r\n09:50:31.858 [main] DEBUG org.apache.http.headers - http-outgoing-1 \u003e\u003e Authorization: Basic QXJu.....\r\n09:50:31.858 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"GET /remote.php/dav/files/my.name@example.com/Nextcloud.mp4/ HTTP/1.1[\\r][\\n]\"\r\n09:50:31.858 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"Host: nextcloud.example.com:443[\\r][\\n]\"\r\n09:50:31.859 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"Connection: Keep-Alive[\\r][\\n]\"\r\n09:50:31.859 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"User-Agent: Sardine/5.10[\\r][\\n]\"\r\n09:50:31.859 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"Accept-Encoding: gzip,deflate[\\r][\\n]\"\r\n09:50:31.859 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"Authorization: Basic QXJu...[\\r][\\n]\"\r\n09:50:31.859 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003e\u003e \"[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"HTTP/1.1 404 Not Found[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Date: Wed, 06 Oct 2021 07:50:31 GMT[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Server: Apache/2.4.25 (Debian)[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Strict-Transport-Security: max-age=15768000 ; includeSubDomains[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Expires: Thu, 19 Nov 1981 08:52:00 GMT[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Cache-Control: no-store, no-cache, must-revalidate[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Pragma: no-cache[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Content-Security-Policy: default-src 'none';[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Referrer-Policy: no-referrer[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"X-Content-Type-Options: nosniff[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"X-Download-Options: noopen[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"X-Frame-Options: SAMEORIGIN[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"X-Permitted-Cross-Domain-Policies: none[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"X-Robots-Tag: none[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"X-XSS-Protection: 1; mode=block[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Content-Length: 253[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Content-Type: application/xml; charset=utf-8[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: oc4ld86aguy6=0ca6a655f8a1e9e694af6eaf6b4b2616; path=/; secure; HttpOnly; SameSite=Lax[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: oc_sessionPassphrase=An5OH5L.....; path=/; secure; HttpOnly; SameSite=Lax[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: oc4ld8....; path=/; secure; HttpOnly; SameSite=Lax[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict[\\r][\\n]\"\r\n09:50:33.499 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: oc4ld86a....; path=/; secure; HttpOnly; SameSite=Lax[\\r][\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Set-Cookie: cookie_test=test; expires=Wed, 06-Oct-2021 08:50:33 GMT; Max-Age=3600[\\r][\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Keep-Alive: timeout=5, max=100[\\r][\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"Connection: Keep-Alive[\\r][\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"[\\r][\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e[\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"\u003cd:error xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\"\u003e[\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \" \u003cs:exception\u003eSabre\\DAV\\Exception\\NotFound\u003c/s:exception\u003e[\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \" \u003cs:message\u003ePrincipal with name my.name@example.com not found\u003c/s:message\u003e[\\n]\"\r\n09:50:33.500 [main] DEBUG org.apache.http.wire - http-outgoing-1 \u003c\u003c \"\u003c/d:error\u003e[\\n]\"\r\n...\r\norg.aarboard.nextcloud.api.exception.NextcloudApiException: com.github.sardine.impl.SardineException: Unexpected response (404 Not Found)\r\n```\r\nThe url \"https://nextcloud.example.com/remote.php/dav/files/my.name@example.com/Nextcloud.mp4/\" results in fact in a 404 error when pasted into the browser. However, when I replace the user name part with the uuid that is listed in the Nextcloud administrator user listing near my full name (\"https://nextcloud.example.com/remote.php/dav/files/BA00370B-3FFZ-4295-8D76-C232DA9B3565/Nextcloud.mp4/\"), I can successfully download the file via the browser.\r\n\r\nSo this shows that the path to the file in the nc.downloadFile call seems to be correct. I also tried replacing my user name by the uuid in the code, but then the login fails.\r\n\r\nPlease advise what to do to successfully download the file by a Java program.","author":{"url":"https://github.com/schirmacher","@type":"Person","name":"schirmacher"},"datePublished":"2021-10-06T09:06:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/68/nextcloud-java-api/issues/68"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3bb6bd7e-b630-a2d1-d4d5-54edb3f07574 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DCE:3D126:D52F98:1129D3C:6990C1B5 |
| html-safe-nonce | 9c5c0b905a4c300012db1ff88d4911a38a432ce57450d73c35fa119ad0e15cd8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RENFOjNEMTI2OkQ1MkY5ODoxMTI5RDNDOjY5OTBDMUI1IiwidmlzaXRvcl9pZCI6IjIyNjU1NTk3MjY3MzY1ODkyMzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | da145e29efbe7ef5013f387af5bc94d9677039f7ae787e29d27a7bf4ca7f95d1 |
| hovercard-subject-tag | issue:1017850328 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/a-schild/nextcloud-java-api/68/issue_layout |
| twitter:image | https://opengraph.githubassets.com/280f123c880a428a6c180e6e54f3ed57527b87528e36f0fa3fcfeb906c282726/a-schild/nextcloud-java-api/issues/68 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/280f123c880a428a6c180e6e54f3ed57527b87528e36f0fa3fcfeb906c282726/a-schild/nextcloud-java-api/issues/68 |
| og:image:alt | I am trying to download a file from Nextcloud (self-hosted, version is 20.0.8.1). The top level view in Nextcloud has a file "Nextcloud.mp4". I have verified that the username and password is corre... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | schirmacher |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/a-schild/nextcloud-java-api git https://github.com/a-schild/nextcloud-java-api.git |
| octolytics-dimension-user_id | 1441009 |
| octolytics-dimension-user_login | a-schild |
| octolytics-dimension-repository_id | 86676911 |
| octolytics-dimension-repository_nwo | a-schild/nextcloud-java-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 86676911 |
| octolytics-dimension-repository_network_root_nwo | a-schild/nextcloud-java-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width