File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments