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] 操作系统文件资源管理器中选中文件拖入到opensumi ide文件树中内容消失 #3615

Open
767746649zyy opened this issue May 6, 2024 · 11 comments
Labels
🐞 bug Something isn't working

Comments

@767746649zyy
Copy link

描述你的问题(Describe the bug)
操作系统文件资源管理器中文件222.env拖入到opensumi ide右侧区域打开,显示正常,文件内容没丢失,如图
image
image

操作系统文件资源管理器中文件222.env拖入到opensumi ide左侧文件树区域test文件夹下并打开,显示异常,文件内容丢失,如图
image
image

复现路径(To Reproduce)

预期表现(Expected behavior)

环境信息(Environment)

  • OS: [e.g. macOS 11.2 Apple M1/Windows10/Windows11]
  • Browser: [e.g. chrome, safari, electron]
  • OpenSumi Version: [e.g. 2.13.0]
@767746649zyy 767746649zyy added the 🐞 bug Something isn't working label May 6, 2024
@erha19
Copy link
Member

erha19 commented May 6, 2024

@767746649zyy 该问题是否涉及你们的一些逻辑修改导致的?在 ide-electron 案例中能复现吗?MacOS 环境下试了一下好像没这个问题。

@767746649zyy
Copy link
Author

@767746649zyy 该问题是否涉及你们的一些逻辑修改导致的?在 ide-electron 案例中能复现吗?MacOS 环境下试了一下好像没这个问题。

我试试看能否在 ide-electron 中复现

@767746649zyy
Copy link
Author

@767746649zyy 该问题是否涉及你们的一些逻辑修改导致的?在 ide-electron 案例中能复现吗?MacOS 环境下试了一下好像没这个问题。

我试试看能否在 ide-electron 中复现

可复现 1.js 文件内容为“function a (){}” 在拖拽到右侧打开展示正确有内容如图1,拖拽到文件树的某个文件夹下展示无内容 如图2
图1
图2
在vscode中直接将操作系统文件资源管理器的文件拖拽到ide 文件树的某个文件夹下无异常,文件内容仍然存在
image

@767746649zyy
Copy link
Author

767746649zyy commented May 6, 2024

opensumi版本2.27.2 2.26.8 均可复现

@erha19
Copy link
Member

erha19 commented May 6, 2024

@767746649zyy 是运行 ide-electron 项目后测试,我这边无法复现这个问题。

@767746649zyy
Copy link
Author

@767746649zyy 是运行 ide-electron 项目后测试,我这边无法复现这个问题。

你们是MacOS 环境下吗 我的是win 10系统 可复现

@erha19
Copy link
Member

erha19 commented May 7, 2024

@767746649zyy 看一下执行日志,打开文件时是否会因为中文或者路径原因读取了错误的文件内容,相关代码位置见:

MacOS 下确实还复现不了这个问题..

@767746649zyy
Copy link
Author

767746649zyy commented May 11, 2024

我看到控制台打印报错了 w我们用的node版本 v14.17.6 会不会版本太低了这个原因
image

@erha19
Copy link
Member

erha19 commented May 11, 2024

@767746649zyy 可以到具体文件这里调试一下看看,加点日志看看,目前看报错就是这个 $writeStream 方法报错,代码见:

$writeStream(chunk: string | ArrayBuffer, fileName: string, targetDir: string, done: boolean): Promise<void> {
const targetPath = Uri.file(path.join(targetDir, fileName)).path;
const stream = this.writeableStreams.get(targetPath);
return new Promise((resolve, reject) => {
stream?.write(chunk, 'binary', (err) => {
if (err) {
reject(err);
}
resolve();
if (done) {
stream.close();
this.writeableStreams.delete(targetPath);
}
});
});
}

@767746649zyy
Copy link
Author

@767746649zyy 可以到具体文件这里调试一下看看,加点日志看看,目前看报错就是这个 $writeStream 方法报错,代码见:

$writeStream(chunk: string | ArrayBuffer, fileName: string, targetDir: string, done: boolean): Promise<void> {
const targetPath = Uri.file(path.join(targetDir, fileName)).path;
const stream = this.writeableStreams.get(targetPath);
return new Promise((resolve, reject) => {
stream?.write(chunk, 'binary', (err) => {
if (err) {
reject(err);
}
resolve();
if (done) {
stream.close();
this.writeableStreams.delete(targetPath);
}
});
});
}

日志文件在哪里 没找到

@erha19
Copy link
Member

erha19 commented May 11, 2024

@767746649zyy 引入一下 INodeLogger,输出一下参数看看是否有误,例如:

@Autowired(INodeLogger)
 private readonly logger: INodeLogger;

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

No branches or pull requests

2 participants