瀏覽代碼

fix(output): quote symbolic links correctly when their destinations contain spaces

Zacchary Dempsey-Plante 2 年之前
父節點
當前提交
54abab7849
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/output/escape.rs

+ 2 - 1
src/output/escape.rs

@@ -8,6 +8,7 @@ pub fn escape(
     bad: Style,
     bad: Style,
     quote_style: QuoteStyle,
     quote_style: QuoteStyle,
 ) {
 ) {
+    let bits_starting_length = bits.len();
     let needs_quotes = string.contains(' ') || string.contains('\'');
     let needs_quotes = string.contains(' ') || string.contains('\'');
     let quote_bit = good.paint(if string.contains('\'') { "\"" } else { "\'" });
     let quote_bit = good.paint(if string.contains('\'') { "\"" } else { "\'" });
 
 
@@ -32,7 +33,7 @@ pub fn escape(
     }
     }
 
 
     if quote_style != QuoteStyle::NoQuotes && needs_quotes {
     if quote_style != QuoteStyle::NoQuotes && needs_quotes {
-        bits.insert(0, quote_bit.clone());
+        bits.insert(bits_starting_length, quote_bit.clone());
         bits.push(quote_bit);
         bits.push(quote_bit);
     }
     }
 }
 }