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

[Bug?] [Help request] v2.11.3无法使用本地的webdav服务 #4335

Closed
1 of 3 tasks
Wedjat98 opened this issue Mar 18, 2024 · 28 comments
Closed
1 of 3 tasks

[Bug?] [Help request] v2.11.3无法使用本地的webdav服务 #4335

Wedjat98 opened this issue Mar 18, 2024 · 28 comments
Labels
bug Something isn't working

Comments

@Wedjat98
Copy link

Bug Description

No PROXY_URL confirmed

我有一个极其简易的webdav服务如下:

const { v2: webdav } = require('webdav-server');

// 创建一个用户管理器
const userManager = new webdav.SimpleUserManager();
const user = userManager.addUser('user', 'pass', false);

// 创建权限管理器并设置权限
const privilegeManager = new webdav.SimplePathPrivilegeManager();
privilegeManager.setRights(user, '/', ['all']);

// 创建WebDAV服务器实例
const server = new webdav.WebDAVServer({
    port: 3900,
    httpAuthentication: new webdav.HTTPBasicAuthentication(userManager),
    privilegeManager: privilegeManager
});

// 设置文件系统并添加错误处理
server.setFileSystem('/', new webdav.PhysicalFileSystem('someDir/webdav'), (success, error) => {
    if (error) {
        console.error('Error setting file system:', error);
        return;
    }
    console.log(`Filesystem loaded successfully: ${success}`);
});

// 在请求开始和结束时添加详细的日志记录
server.beforeRequest((req, next) => {
    console.log(`Incoming request: ${req.method} ${req.url}`);
    console.log(`Headers: ${JSON.stringify(req.headers)}`);
    next();
});

server.afterRequest((req, next) => {
    console.log(`Completed request: ${req.method} ${req.url} - Status: ${req.response.statusCode}`);
    next();
});

// 启动服务器
server.start(() => console.log('WebDAV server started on port 3900'));

我在v2.11.2 是可以正常使用这个服务来同步对话历史到不同的设备,但是升级至v2.11.3我无法使用了。请问我应该怎么做?或者我应该从哪里获取到同步失败的相关log?

Steps to Reproduce

update to 2.11.3 and Sync the chat histories then show dialog Sync Fail

Expected Behavior

Sync Success

Screenshots

No response

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

No response

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

@Wedjat98 Wedjat98 added the bug Something isn't working label Mar 18, 2024
@nextchat-manager
Copy link

Please follow the issue template to update title and description of your issue.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug?] [Help request] v2.11.3 cannot use the local webdav service

@fred-bf
Copy link
Contributor

fred-bf commented Mar 18, 2024

@Wedjat98 could you share the console log from your browser when sync with webdav?

@Wedjat98
Copy link
Author

@fred-bf

Sure! Here is it.

[Sync] failed to get remote state TypeError: URL constructor: /api/cors//api/webdav/chatgpt-next-web/backup.json/ is not a valid URL.
    NextJS 33
[page-606a277117982b1d.js:1:232420](http://192.168.0.244:3000/_next/static/chunks/app/page-606a277117982b1d.js)
[Sync] TypeError: URL constructor: /api/cors//api/webdav/chatgpt-next-web/backup.json/ is not a valid URL.
    NextJS 33
[7698-bb5d18468650f39a.js:1:3423](http://192.168.0.244:3000/_next/static/chunks/7698-bb5d18468650f39a.js)
    NextJS 31

@mosimod
Copy link

mosimod commented Mar 18, 2024

I have the save issue

@fred-bf
Copy link
Contributor

fred-bf commented Mar 19, 2024

working on it, it should cause by a recent security update

@MC-dusk
Copy link

MC-dusk commented Mar 19, 2024

我在使用坚果云webdav,点击“同步”显示成功了,但是去网盘实际看文件没有更新

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I am using Nut Cloud webdav. When I click "Synchronize", it shows success, but when I go to the network disk to actually view the file, it is not updated.

@MC-dusk
Copy link

MC-dusk commented Mar 19, 2024

我在使用坚果云webdav,点击“同步”显示成功了,但是去网盘实际看文件没有更新

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I am using Nut Cloud webdav. When I click "Synchronize", it shows success, but when I go to the network disk to actually view the file, it is not updated.

@yuluod
Copy link

yuluod commented Mar 19, 2024

我在使用坚果云webdav,点击“同步”显示成功了,但是去网盘实际看文件没有更新

同样也遇到了这个问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I am using Nut Cloud webdav. Clicking "Sync" shows success, but when I go to the network disk to actually view the file, it is not updated.

Also encountered this problem

@H0llyW00dzZ
Copy link
Contributor

Bug Description

No PROXY_URL confirmed

我有一个极其简易的webdav服务如下:

const { v2: webdav } = require('webdav-server');

// 创建一个用户管理器
const userManager = new webdav.SimpleUserManager();
const user = userManager.addUser('user', 'pass', false);

// 创建权限管理器并设置权限
const privilegeManager = new webdav.SimplePathPrivilegeManager();
privilegeManager.setRights(user, '/', ['all']);

// 创建WebDAV服务器实例
const server = new webdav.WebDAVServer({
    port: 3900,
    httpAuthentication: new webdav.HTTPBasicAuthentication(userManager),
    privilegeManager: privilegeManager
});

// 设置文件系统并添加错误处理
server.setFileSystem('/', new webdav.PhysicalFileSystem('someDir/webdav'), (success, error) => {
    if (error) {
        console.error('Error setting file system:', error);
        return;
    }
    console.log(`Filesystem loaded successfully: ${success}`);
});

// 在请求开始和结束时添加详细的日志记录
server.beforeRequest((req, next) => {
    console.log(`Incoming request: ${req.method} ${req.url}`);
    console.log(`Headers: ${JSON.stringify(req.headers)}`);
    next();
});

server.afterRequest((req, next) => {
    console.log(`Completed request: ${req.method} ${req.url} - Status: ${req.response.statusCode}`);
    next();
});

// 启动服务器
server.start(() => console.log('WebDAV server started on port 3900'));

我在v2.11.2 是可以正常使用这个服务来同步对话历史到不同的设备,但是升级至v2.11.3我无法使用了。请问我应该怎么做?或者我应该从哪里获取到同步失败的相关log?

Steps to Reproduce

update to 2.11.3 and Sync the chat histories then show dialog Sync Fail

Expected Behavior

Sync Success

Screenshots

No response

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

No response

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

try this #4353

@Wedjat98
Copy link
Author

@H0llyW00dzZ
Thx for your help.
I have tried your version. But it didn't worked as well.

When I clicked the Check Connection button, Console showed this:

XHRMKCOL
[http://192.168.0.244:3000/api/upstash/chatgpt-next-web?endpoint=http://192.168.0.244:3900](http://192.168.0.244:3000/api/upstash/chatgpt-next-web?endpoint=http%3A%2F%2F192.168.0.244%3A3900)
[HTTP/1.1 404 Not Found 30ms]

[WebDav] check 404 Not Found [page-1b933c022a7b0acd.js:1:239001](http://192.168.0.244:3000/_next/static/chunks/app/page-1b933c022a7b0acd.js)

btw the sysc status icon seems like turned checked, that isn't true.
image

Sync button showed this:

XHRGET
[http://192.168.0.244:3000/api/upstash/chatgpt-next-web/backup.json?endpoint=http://192.168.0.244:3900](http://192.168.0.244:3000/api/upstash/chatgpt-next-web/backup.json?endpoint=http%3A%2F%2F192.168.0.244%3A3900)
[HTTP/1.1 403 Forbidden 31ms]

[WebDav] get key =  admin 403 Forbidden [page-1b933c022a7b0acd.js:1:239257](http://192.168.0.244:3000/_next/static/chunks/app/page-1b933c022a7b0acd.js)
[Sync] failed to get remote state TypeError: t is undefined
    NextJS 34
[page-1b933c022a7b0acd.js:1:232439](http://192.168.0.244:3000/_next/static/chunks/app/page-1b933c022a7b0acd.js)

Hope those log is useful to your work.

Thx again.

@Wedjat98
Copy link
Author

Wedjat98 commented Mar 22, 2024

I have rolled back to the v2.11.2.
When I clicked the Check Connection button, Console showed this:

[CORS] target =  /api/cors/http/192.168.0.244:3900/chatgpt-next-web [page-8ad94c71eb7e5987.js:1:236651](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
XHRPOST
http://192.168.0.244:3000/api/cors/http/192.168.0.244:3900/chatgpt-next-web
[HTTP/1.1 405 Method Not Allowed 56ms]

I have check this request seems like to create a directory(?) by MKCOL method. Normally MKCOL is acceptable.

When I click the Sync button Console showed this:

[WebDav] check 405 Method Not Allowed [page-8ad94c71eb7e5987.js:1:235317](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[CORS] target =  /api/cors/http/192.168.0.244:3900/chatgpt-next-web/backup.json [page-8ad94c71eb7e5987.js:1:236651](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
XHRPOST
http://192.168.0.244:3000/api/cors/http/192.168.0.244:3900/chatgpt-next-web/backup.json
[HTTP/1.1 404 Not Found 50ms]

[WebDav] get key =  admin 404 Not Found [page-8ad94c71eb7e5987.js:1:235584](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[Sync] failed to get remote state SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
    NextJS 32
[page-8ad94c71eb7e5987.js:1:228903](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[CORS] target =  /api/cors/http/192.168.0.244:3900/chatgpt-next-web/backup.json [page-8ad94c71eb7e5987.js:1:236651](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[WebDav] set key =  admin 201 Created

then Sync is successful and file backup.json is created.

@H0llyW00dzZ
Copy link
Contributor

@H0llyW00dzZ Thx for your help. I have tried your version. But it didn't worked as well.

When I clicked the Check Connection button, Console showed this:

XHRMKCOL
[http://192.168.0.244:3000/api/upstash/chatgpt-next-web?endpoint=http://192.168.0.244:3900](http://192.168.0.244:3000/api/upstash/chatgpt-next-web?endpoint=http%3A%2F%2F192.168.0.244%3A3900)
[HTTP/1.1 404 Not Found 30ms]

[WebDav] check 404 Not Found [page-1b933c022a7b0acd.js:1:239001](http://192.168.0.244:3000/_next/static/chunks/app/page-1b933c022a7b0acd.js)

btw the sysc status icon seems like turned checked, that isn't true. image

Sync button showed this:

XHRGET
[http://192.168.0.244:3000/api/upstash/chatgpt-next-web/backup.json?endpoint=http://192.168.0.244:3900](http://192.168.0.244:3000/api/upstash/chatgpt-next-web/backup.json?endpoint=http%3A%2F%2F192.168.0.244%3A3900)
[HTTP/1.1 403 Forbidden 31ms]

[WebDav] get key =  admin 403 Forbidden [page-1b933c022a7b0acd.js:1:239257](http://192.168.0.244:3000/_next/static/chunks/app/page-1b933c022a7b0acd.js)
[Sync] failed to get remote state TypeError: t is undefined
    NextJS 34
[page-1b933c022a7b0acd.js:1:232439](http://192.168.0.244:3000/_next/static/chunks/app/page-1b933c022a7b0acd.js)

Hope those log is useful to your work.

Thx again.

It seems that the issue is because the /api/cors/ route was removed, which caused a conflict between the client-side and server-side code.

I have rolled back to the v2.11.2. When I clicked the Check Connection button, Console showed this:

[CORS] target =  /api/cors/http/192.168.0.244:3900/chatgpt-next-web [page-8ad94c71eb7e5987.js:1:236651](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
XHRPOST
http://192.168.0.244:3000/api/cors/http/192.168.0.244:3900/chatgpt-next-web
[HTTP/1.1 405 Method Not Allowed 56ms]

I have check this request seems like to create a directory(?) by MKCOL method. Normally MKCOL is acceptable.

When I click the Sync button Console showed this:

[WebDav] check 405 Method Not Allowed [page-8ad94c71eb7e5987.js:1:235317](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[CORS] target =  /api/cors/http/192.168.0.244:3900/chatgpt-next-web/backup.json [page-8ad94c71eb7e5987.js:1:236651](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
XHRPOST
http://192.168.0.244:3000/api/cors/http/192.168.0.244:3900/chatgpt-next-web/backup.json
[HTTP/1.1 404 Not Found 50ms]

[WebDav] get key =  admin 404 Not Found [page-8ad94c71eb7e5987.js:1:235584](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[Sync] failed to get remote state SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
    NextJS 32
[page-8ad94c71eb7e5987.js:1:228903](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[CORS] target =  /api/cors/http/192.168.0.244:3900/chatgpt-next-web/backup.json [page-8ad94c71eb7e5987.js:1:236651](http://192.168.0.244:3000/_next/static/chunks/app/page-8ad94c71eb7e5987.js)
[WebDav] set key =  admin 201 Created

then Sync is successful and file backup.json is created.

For the old version, you may need to temporarily block internal IP addresses because the old version might still be vulnerable to Server-Side Request Forgery (SSRF) when hosted on cloud platforms like AWS due to lack of proper configuration or misconfiguration.

@H0llyW00dzZ
Copy link
Contributor

Also, I have already found and identified a better method for handling this issue. However, I plan to start implementing it next month after Eid Mubarak, as I currently don't have much free time available.

@zhaobudaomingzi
Copy link

我在使用坚果云webdav,点击“同步”显示成功了,但是去网盘实际看文件没有更新

我也遇到了这个问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I am using Nut Cloud webdav. Clicking "Sync" shows success, but when I go to the network disk to actually view the file, it is not updated.

I also encountered this problem

@jetaimy
Copy link

jetaimy commented Apr 3, 2024

使用同样的upstash地址和token,2.10.3可以同步,2.11.3同步失败:
image

@404gods
Copy link

404gods commented Apr 11, 2024

同样问题,今天更新了最新的代码试了infini-cloud.net的webdav网盘,显示同步成功,但是网盘里空空如也

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I have the same problem. I updated the latest code today and tried the webdav network disk of infini-cloud.net. It shows that the synchronization is successful, but the network disk is empty.

@SakuraKoi
Copy link

SakuraKoi commented Apr 11, 2024

image

image
Cause: proxyUrl's value in frontend is /, then the relative path is not a valid URL
Solution: set proxyUrl to your domain

@Dean-YZG
Copy link
Contributor

使用同样的upstash地址和token,2.10.3可以同步,2.11.3同步失败: image

it has been fixed in this pr #4525

@hexsix
Copy link

hexsix commented Apr 16, 2024

it has been fixed in this pr #4525

@Dean-YZG json parse error in new pr.

Logs
page-df770995f097e59f.js:1 [Config] got config from build time {version: 'v2.11.3', commitDate: '1713250762000', commitHash: '9b2cb1e1c3252298c8a94fb195af683ac7aea5e9', buildMode: 'standalone', isApp: false}
serviceWorkerRegister.js:4 ServiceWorker registration successful with scope:  https://exmaple.com/
670.3f8d4b1ccea09673.js:1 [Update] local version  v2.11.3
670.3f8d4b1ccea09673.js:1 [Update] remote version  v2.11.3
page-df770995f097e59f.js:1 [Config] got config from server {needCode: true, hideUserApiKey: false, disableGPT4: false, hideBalanceQuery: true, disableFastLink: false, …}
page-df770995f097e59f.js:1 
        
        
       GET https://example.com/api/webdav/chatgpt-next-web/backup.json?endpoint=https://dav.jianguoyun.com/dav/ 520
get @ page-df770995f097e59f.js:1
sync @ page-df770995f097e59f.js:1
onClick @ 670.3f8d4b1ccea09673.js:1
l5 @ bce60fc1-e55b90606913faf1.js:9
ar @ bce60fc1-e55b90606913faf1.js:9
(anonymous) @ bce60fc1-e55b90606913faf1.js:9
u2 @ bce60fc1-e55b90606913faf1.js:9
u3 @ bce60fc1-e55b90606913faf1.js:9
(anonymous) @ bce60fc1-e55b90606913faf1.js:9
oS @ bce60fc1-e55b90606913faf1.js:9
ir @ bce60fc1-e55b90606913faf1.js:9
u9 @ bce60fc1-e55b90606913faf1.js:9
i6 @ bce60fc1-e55b90606913faf1.js:9
i4 @ bce60fc1-e55b90606913faf1.js:9
page-df770995f097e59f.js:1 [WebDav] get key =  account_name@jianguoyun.com 520 
page-df770995f097e59f.js:1 [Sync] failed to get remote state SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at Object.sync (page-df770995f097e59f.js:1:247469)
    at async onClick (670.3f8d4b1ccea09673.js:1:16330)
7698-bb5d18468650f39a.js:1 [Sync] SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at Object.sync (page-df770995f097e59f.js:1:247469)
    at async onClick (670.3f8d4b1ccea09673.js:1:16330)
window.console.error @ 7698-bb5d18468650f39a.js:1
onClick @ 670.3f8d4b1ccea09673.js:1
await in onClick (async)
l5 @ bce60fc1-e55b90606913faf1.js:9
ar @ bce60fc1-e55b90606913faf1.js:9
(anonymous) @ bce60fc1-e55b90606913faf1.js:9
u2 @ bce60fc1-e55b90606913faf1.js:9
u3 @ bce60fc1-e55b90606913faf1.js:9
(anonymous) @ bce60fc1-e55b90606913faf1.js:9
oS @ bce60fc1-e55b90606913faf1.js:9
ir @ bce60fc1-e55b90606913faf1.js:9
u9 @ bce60fc1-e55b90606913faf1.js:9
i6 @ bce60fc1-e55b90606913faf1.js:9
i4 @ bce60fc1-e55b90606913faf1.js:9

@zhaobudaomingzi
Copy link

it has been fixed in this pr #4525

还是同步失败

@mghcool
Copy link

mghcool commented May 15, 2024

到底应该怎样做才能同步成功?现在2.12.3版本还是不能同步

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


What should be done to achieve successful synchronization? Now version 2.12.3 still cannot be synchronized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.