File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,22 @@ pub(super) fn open_browser_internal(
5454 return Err ( Error :: other ( "failed to get default browser" ) ) ;
5555 }
5656
57+ let mut line_len = line_len as usize ;
58+
59+ // If line_len wasn't updated, this might be a broken AssocQueryStringW() implementation in wine:
60+ // https://bugs.winehq.org/show_bug.cgi?id=59402
61+ // In that case, find the NUL terminator ourselves.
62+ if line_len == BUF_SIZE {
63+ if let Some ( found_nul) = cmdline_u16. iter ( ) . position ( |& c| c == 0 ) {
64+ trace ! (
65+ "Broken AssocQueryStringW(), manually string length determined at {found_nul}"
66+ ) ;
67+ line_len = found_nul + 1 ;
68+ }
69+ }
70+
5771 use std:: os:: windows:: ffi:: OsStringExt ;
58- std:: ffi:: OsString :: from_wide ( & cmdline_u16[ ..( line_len - 1 ) as usize ] )
72+ std:: ffi:: OsString :: from_wide ( & cmdline_u16[ ..( line_len - 1 ) ] )
5973 . into_string ( )
6074 . map_err ( |_err| {
6175 Error :: other (
You can’t perform that action at this time.
0 commit comments