Skip to content

Commit f7673a9

Browse files
committed
fix: file copy paste not workin gin file tree
1 parent 964210b commit f7673a9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src-electron/main-window-ipc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ function registerWindowIpcHandlers() {
244244
// Try reading as file URLs
245245
const text = clipboard.read('public.file-url');
246246
if (text) {
247-
// Convert file:// URLs to paths
248-
const paths = text.split('\n')
247+
// Convert file:// URLs to paths (handle both \n and \r\n line endings)
248+
const paths = text.split(/\r?\n/)
249249
.filter(url => url.startsWith('file://'))
250250
.map(url => decodeURIComponent(url.replace('file://', '')));
251251
if (paths.length > 0) {
@@ -254,11 +254,11 @@ function registerWindowIpcHandlers() {
254254
}
255255
}
256256

257-
// Linux: text/uri-list format
257+
// Linux: text/uri-list format (uses \r\n line endings per RFC 2483)
258258
if (process.platform === 'linux' && formats.includes('text/uri-list')) {
259259
const text = clipboard.read('text/uri-list');
260260
if (text) {
261-
const paths = text.split('\n')
261+
const paths = text.split(/\r?\n/)
262262
.filter(url => url.startsWith('file://'))
263263
.map(url => decodeURIComponent(url.replace('file://', '')));
264264
if (paths.length > 0) {

0 commit comments

Comments
 (0)