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

wfs.rename Headers Destination forbidden #85

Open
sytolk opened this issue Jun 29, 2022 · 2 comments
Open

wfs.rename Headers Destination forbidden #85

sytolk opened this issue Jun 29, 2022 · 2 comments

Comments

@sytolk
Copy link

sytolk commented Jun 29, 2022

after rename

wfs.rename("/sample.bmp", "/sample1.bmp", err => {
    // handle error
});

this is the error:

{
  "message": "Network Error",
  "name": "AxiosError",
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {},
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Authorization": "Basic d2ViZGF2OjEyMzQ=",
      "Destination": "http://localhost:8000/sample1.bmp"
    },
    "url": "http://localhost:8000/sample.bmp",
    "method": "move"
  },
  "code": "ERR_NETWORK",
  "status": null
}
console.error
     Error: Headers Destination forbidden
         at dispatchError (/Users/sytolk/IdeaProjects/tagspaces-common/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:63:19)
         at validCORSPreflightHeaders (/Users/sytolk/IdeaProjects/tagspaces-common/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:102:5)
         at Request.<anonymous> (/Users/sytolk/IdeaProjects/tagspaces-common/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:374:12)
         at Request.emit (events.js:400:28)
         at Request._processResponse (/Users/sytolk/IdeaProjects/tagspaces-common/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:228:12)
         at ClientRequest.<anonymous> (/Users/sytolk/IdeaProjects/tagspaces-common/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:101:12)
         at Object.onceWrapper (events.js:520:26)
         at ClientRequest.emit (events.js:400:28)
         at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:647:27)
         at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17) undefined

@sytolk
Copy link
Author

sytolk commented Jun 30, 2022

It appers that this header is forbidden:
https://github.com/perry-mitchell/webdav-client/blob/master/source/operations/moveFile.ts#L18
I have this error in testing enviroment with "webdav-server": "^2.6.2"

@sytolk
Copy link
Author

sytolk commented Jun 30, 2022

I have fix this after adding Destination header in Access-Control-Allow-Headers:

headers: {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Methods":
        "HEAD, GET, PUT, PROPFIND, DELETE, OPTIONS, MKCOL, MOVE, COPY",
      "Access-Control-Allow-Headers":
        "Accept, Authorization, Content-Type, Content-Length, Depth, Destination",
    },

but it strange that in your tests works without this header: https://github.com/perry-mitchell/webdav-fs/blob/master/test/specs/index.js#L53

I have jsdom dependency in node_modules (node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js)
1233D818-29A2-41E7-9A55-5891AF50706E

@sytolk sytolk changed the title rename Network Error wfs.rename Headers Destination forbidden Jun 30, 2022
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

1 participant