Fossil SCM

Fix a bug in Windows builds introduced by [fc0b9325f02b16b3]: When escaping arguments for the CMD.EXE which are not filenames, allow % to pass through unaltered and unquoted. This is necessary so that we can construct a URL that contains a "%d" field to hold the TCP port number.

drh 2024-02-24 11:33 trunk
Commit c2c02cd7d1f50df46df9e3437cc4a8258cdb4622e358d760bc2921cceeb13d05
1 file changed +1 -1
+1 -1
--- src/blob.c
+++ src/blob.c
@@ -1701,11 +1701,11 @@
17011701
}
17021702
for(i=0; (c = (unsigned char)zIn[i])!=0; i++){
17031703
blob_append_char(pBlob, (char)c);
17041704
if( c=='"' ) blob_append_char(pBlob, '"');
17051705
if( c=='\\' ) blob_append_char(pBlob, '\\');
1706
- if( c=='%' ) blob_append(pBlob, "%cd:~,%", 7);
1706
+ if( c=='%' && isFilename ) blob_append(pBlob, "%cd:~,%", 7);
17071707
}
17081708
blob_append_char(pBlob, '"');
17091709
#else
17101710
/* Quoting strategy for unix:
17111711
** If the name does not contain ', then surround the whole thing
17121712
--- src/blob.c
+++ src/blob.c
@@ -1701,11 +1701,11 @@
1701 }
1702 for(i=0; (c = (unsigned char)zIn[i])!=0; i++){
1703 blob_append_char(pBlob, (char)c);
1704 if( c=='"' ) blob_append_char(pBlob, '"');
1705 if( c=='\\' ) blob_append_char(pBlob, '\\');
1706 if( c=='%' ) blob_append(pBlob, "%cd:~,%", 7);
1707 }
1708 blob_append_char(pBlob, '"');
1709 #else
1710 /* Quoting strategy for unix:
1711 ** If the name does not contain ', then surround the whole thing
1712
--- src/blob.c
+++ src/blob.c
@@ -1701,11 +1701,11 @@
1701 }
1702 for(i=0; (c = (unsigned char)zIn[i])!=0; i++){
1703 blob_append_char(pBlob, (char)c);
1704 if( c=='"' ) blob_append_char(pBlob, '"');
1705 if( c=='\\' ) blob_append_char(pBlob, '\\');
1706 if( c=='%' && isFilename ) blob_append(pBlob, "%cd:~,%", 7);
1707 }
1708 blob_append_char(pBlob, '"');
1709 #else
1710 /* Quoting strategy for unix:
1711 ** If the name does not contain ', then surround the whole thing
1712

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button