Fossil SCM

Merge trunk into small-fixes.

stephan 2026-11-22 13:01 UTC small-fixes merge
Commit 48aa175c12ad2166a71dbdc60583a8ce947bd8139cf341c055736217f0d66579
+2 -2
--- src/alerts.c
+++ src/alerts.c
@@ -1831,11 +1831,11 @@
18311831
** The subscriber is identified in several ways:
18321832
**
18331833
** * The name= query parameter contains the complete subscriberCode.
18341834
** This only happens when the user receives a verification
18351835
** email and clicks on the link in the email. When a
1836
-** compilete subscriberCode is seen on the name= query parameter,
1836
+** complete subscriberCode is seen on the name= query parameter,
18371837
** that constitutes verification of the email address.
18381838
**
18391839
** * The sid= query parameter contains an integer subscriberId.
18401840
** This only works for the administrator. It allows the
18411841
** administrator to edit any subscription.
@@ -2266,11 +2266,11 @@
22662266
**
22672267
** Non-logged-in users with no name= query parameter are invited to enter
22682268
** an email address to which will be sent the unsubscribe link that
22692269
** contains the correct subscriber code.
22702270
**
2271
-** The /unsubscribe page requires comfirmation. The /oneclickunsub
2271
+** The /unsubscribe page requires confirmation. The /oneclickunsub
22722272
** page unsubscribes immediately without any need to confirm.
22732273
*/
22742274
void unsubscribe_page(void){
22752275
const char *zName = P("name");
22762276
char *zErr = 0;
22772277
--- src/alerts.c
+++ src/alerts.c
@@ -1831,11 +1831,11 @@
1831 ** The subscriber is identified in several ways:
1832 **
1833 ** * The name= query parameter contains the complete subscriberCode.
1834 ** This only happens when the user receives a verification
1835 ** email and clicks on the link in the email. When a
1836 ** compilete subscriberCode is seen on the name= query parameter,
1837 ** that constitutes verification of the email address.
1838 **
1839 ** * The sid= query parameter contains an integer subscriberId.
1840 ** This only works for the administrator. It allows the
1841 ** administrator to edit any subscription.
@@ -2266,11 +2266,11 @@
2266 **
2267 ** Non-logged-in users with no name= query parameter are invited to enter
2268 ** an email address to which will be sent the unsubscribe link that
2269 ** contains the correct subscriber code.
2270 **
2271 ** The /unsubscribe page requires comfirmation. The /oneclickunsub
2272 ** page unsubscribes immediately without any need to confirm.
2273 */
2274 void unsubscribe_page(void){
2275 const char *zName = P("name");
2276 char *zErr = 0;
2277
--- src/alerts.c
+++ src/alerts.c
@@ -1831,11 +1831,11 @@
1831 ** The subscriber is identified in several ways:
1832 **
1833 ** * The name= query parameter contains the complete subscriberCode.
1834 ** This only happens when the user receives a verification
1835 ** email and clicks on the link in the email. When a
1836 ** complete subscriberCode is seen on the name= query parameter,
1837 ** that constitutes verification of the email address.
1838 **
1839 ** * The sid= query parameter contains an integer subscriberId.
1840 ** This only works for the administrator. It allows the
1841 ** administrator to edit any subscription.
@@ -2266,11 +2266,11 @@
2266 **
2267 ** Non-logged-in users with no name= query parameter are invited to enter
2268 ** an email address to which will be sent the unsubscribe link that
2269 ** contains the correct subscriber code.
2270 **
2271 ** The /unsubscribe page requires confirmation. The /oneclickunsub
2272 ** page unsubscribes immediately without any need to confirm.
2273 */
2274 void unsubscribe_page(void){
2275 const char *zName = P("name");
2276 char *zErr = 0;
2277
+6 -4
--- src/blob.c
+++ src/blob.c
@@ -872,15 +872,15 @@
872872
char *aData = pFrom->aData;
873873
int n = pFrom->nUsed;
874874
int i = pFrom->iCursor;
875875
while( i<n && fossil_isspace(aData[i]) ){ i++; }
876876
pFrom->iCursor = i;
877
- if( aData[i]=='\'' ){
877
+ if( i<n && aData[i]=='\'' ){
878878
i++;
879879
while( i<n ){
880880
if( aData[i]=='\'' ){
881
- if( aData[++i]!='\'' ) break;
881
+ if( ++i>=n || aData[i]!='\'' ) break;
882882
}
883883
i++;
884884
}
885885
}else{
886886
while( i<n && !fossil_isspace(aData[i]) ){ i++; }
@@ -1488,10 +1488,12 @@
14881488
/*
14891489
** Uncompress blob pIn and store the result in pOut. It is ok for pIn and
14901490
** pOut to be the same blob.
14911491
**
14921492
** pOut must be either uninitialized or the same as pIn.
1493
+**
1494
+** Return the number of errors encountered, which means return 0 on success.
14931495
*/
14941496
int blob_uncompress(Blob *pIn, Blob *pOut){
14951497
unsigned int nOut;
14961498
unsigned char *inBuf;
14971499
unsigned int nIn = blob_size(pIn);
@@ -1502,11 +1504,11 @@
15021504
return 0;
15031505
}
15041506
inBuf = (unsigned char*)blob_buffer(pIn);
15051507
nOut = (inBuf[0]<<24) + (inBuf[1]<<16) + (inBuf[2]<<8) + inBuf[3];
15061508
blob_zero(&temp);
1507
- blob_resize(&temp, nOut+1);
1509
+ blob_resize(&temp, (u64)nOut+1);
15081510
nOut2 = (long int)nOut;
15091511
rc = uncompress((unsigned char*)blob_buffer(&temp), &nOut2,
15101512
&inBuf[4], nIn - 4);
15111513
if( rc!=Z_OK ){
15121514
blob_reset(&temp);
@@ -1855,11 +1857,11 @@
18551857
** --hex HEX Skip the --hex flag and instead decode HEX
18561858
** into ascii. This provides a way to insert
18571859
** unusual characters as an argument for testing.
18581860
**
18591861
** --compare HEX ASCII Verify that argument ASCII is identical to
1860
-** to decoded HEX.
1862
+** decoded HEX.
18611863
**
18621864
** --fuzz N Run N fuzz cases. Each case is a call
18631865
** to "fossil test-escaped-arg --compare HEX ARG"
18641866
** where HEX and ARG are the same argument.
18651867
** The argument is chosen at random.
18661868
--- src/blob.c
+++ src/blob.c
@@ -872,15 +872,15 @@
872 char *aData = pFrom->aData;
873 int n = pFrom->nUsed;
874 int i = pFrom->iCursor;
875 while( i<n && fossil_isspace(aData[i]) ){ i++; }
876 pFrom->iCursor = i;
877 if( aData[i]=='\'' ){
878 i++;
879 while( i<n ){
880 if( aData[i]=='\'' ){
881 if( aData[++i]!='\'' ) break;
882 }
883 i++;
884 }
885 }else{
886 while( i<n && !fossil_isspace(aData[i]) ){ i++; }
@@ -1488,10 +1488,12 @@
1488 /*
1489 ** Uncompress blob pIn and store the result in pOut. It is ok for pIn and
1490 ** pOut to be the same blob.
1491 **
1492 ** pOut must be either uninitialized or the same as pIn.
 
 
1493 */
1494 int blob_uncompress(Blob *pIn, Blob *pOut){
1495 unsigned int nOut;
1496 unsigned char *inBuf;
1497 unsigned int nIn = blob_size(pIn);
@@ -1502,11 +1504,11 @@
1502 return 0;
1503 }
1504 inBuf = (unsigned char*)blob_buffer(pIn);
1505 nOut = (inBuf[0]<<24) + (inBuf[1]<<16) + (inBuf[2]<<8) + inBuf[3];
1506 blob_zero(&temp);
1507 blob_resize(&temp, nOut+1);
1508 nOut2 = (long int)nOut;
1509 rc = uncompress((unsigned char*)blob_buffer(&temp), &nOut2,
1510 &inBuf[4], nIn - 4);
1511 if( rc!=Z_OK ){
1512 blob_reset(&temp);
@@ -1855,11 +1857,11 @@
1855 ** --hex HEX Skip the --hex flag and instead decode HEX
1856 ** into ascii. This provides a way to insert
1857 ** unusual characters as an argument for testing.
1858 **
1859 ** --compare HEX ASCII Verify that argument ASCII is identical to
1860 ** to decoded HEX.
1861 **
1862 ** --fuzz N Run N fuzz cases. Each case is a call
1863 ** to "fossil test-escaped-arg --compare HEX ARG"
1864 ** where HEX and ARG are the same argument.
1865 ** The argument is chosen at random.
1866
--- src/blob.c
+++ src/blob.c
@@ -872,15 +872,15 @@
872 char *aData = pFrom->aData;
873 int n = pFrom->nUsed;
874 int i = pFrom->iCursor;
875 while( i<n && fossil_isspace(aData[i]) ){ i++; }
876 pFrom->iCursor = i;
877 if( i<n && aData[i]=='\'' ){
878 i++;
879 while( i<n ){
880 if( aData[i]=='\'' ){
881 if( ++i>=n || aData[i]!='\'' ) break;
882 }
883 i++;
884 }
885 }else{
886 while( i<n && !fossil_isspace(aData[i]) ){ i++; }
@@ -1488,10 +1488,12 @@
1488 /*
1489 ** Uncompress blob pIn and store the result in pOut. It is ok for pIn and
1490 ** pOut to be the same blob.
1491 **
1492 ** pOut must be either uninitialized or the same as pIn.
1493 **
1494 ** Return the number of errors encountered, which means return 0 on success.
1495 */
1496 int blob_uncompress(Blob *pIn, Blob *pOut){
1497 unsigned int nOut;
1498 unsigned char *inBuf;
1499 unsigned int nIn = blob_size(pIn);
@@ -1502,11 +1504,11 @@
1504 return 0;
1505 }
1506 inBuf = (unsigned char*)blob_buffer(pIn);
1507 nOut = (inBuf[0]<<24) + (inBuf[1]<<16) + (inBuf[2]<<8) + inBuf[3];
1508 blob_zero(&temp);
1509 blob_resize(&temp, (u64)nOut+1);
1510 nOut2 = (long int)nOut;
1511 rc = uncompress((unsigned char*)blob_buffer(&temp), &nOut2,
1512 &inBuf[4], nIn - 4);
1513 if( rc!=Z_OK ){
1514 blob_reset(&temp);
@@ -1855,11 +1857,11 @@
1857 ** --hex HEX Skip the --hex flag and instead decode HEX
1858 ** into ascii. This provides a way to insert
1859 ** unusual characters as an argument for testing.
1860 **
1861 ** --compare HEX ASCII Verify that argument ASCII is identical to
1862 ** decoded HEX.
1863 **
1864 ** --fuzz N Run N fuzz cases. Each case is a call
1865 ** to "fossil test-escaped-arg --compare HEX ARG"
1866 ** where HEX and ARG are the same argument.
1867 ** The argument is chosen at random.
1868
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -629,11 +629,11 @@
629629
** Print the name of the branch for the current check-out
630630
**
631631
** > fossil branch hide|unhide ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES?
632632
**
633633
** Adds or cancels the "hidden" tag for the specified branches or
634
-** or check-in IDs. Accepts the same options as the close
634
+** check-in IDs. Accepts the same options as the close
635635
** subcommand.
636636
**
637637
** > fossil branch info BRANCH-NAME
638638
**
639639
** Print information about a branch
640640
--- src/branch.c
+++ src/branch.c
@@ -629,11 +629,11 @@
629 ** Print the name of the branch for the current check-out
630 **
631 ** > fossil branch hide|unhide ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES?
632 **
633 ** Adds or cancels the "hidden" tag for the specified branches or
634 ** or check-in IDs. Accepts the same options as the close
635 ** subcommand.
636 **
637 ** > fossil branch info BRANCH-NAME
638 **
639 ** Print information about a branch
640
--- src/branch.c
+++ src/branch.c
@@ -629,11 +629,11 @@
629 ** Print the name of the branch for the current check-out
630 **
631 ** > fossil branch hide|unhide ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES?
632 **
633 ** Adds or cancels the "hidden" tag for the specified branches or
634 ** check-in IDs. Accepts the same options as the close
635 ** subcommand.
636 **
637 ** > fossil branch info BRANCH-NAME
638 **
639 ** Print information about a branch
640
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -710,11 +710,11 @@
710710
int rc;
711711
if( g.zBaseURL==0 ) return 0;
712712
zRef = P("HTTP_REFERER");
713713
if( zRef==0 ) return 0;
714714
if( strchr(zRef,'%')!=0 ){
715
- zToFree = strdup(zRef);
715
+ zToFree = fossil_strdup(zRef);
716716
dehttpize(zToFree);
717717
zRef = zToFree;
718718
}
719719
nBase = (int)strlen(g.zBaseURL);
720720
if( fossil_strncmp(g.zBaseURL,zRef,nBase)!=0 ){
721721
--- src/cgi.c
+++ src/cgi.c
@@ -710,11 +710,11 @@
710 int rc;
711 if( g.zBaseURL==0 ) return 0;
712 zRef = P("HTTP_REFERER");
713 if( zRef==0 ) return 0;
714 if( strchr(zRef,'%')!=0 ){
715 zToFree = strdup(zRef);
716 dehttpize(zToFree);
717 zRef = zToFree;
718 }
719 nBase = (int)strlen(g.zBaseURL);
720 if( fossil_strncmp(g.zBaseURL,zRef,nBase)!=0 ){
721
--- src/cgi.c
+++ src/cgi.c
@@ -710,11 +710,11 @@
710 int rc;
711 if( g.zBaseURL==0 ) return 0;
712 zRef = P("HTTP_REFERER");
713 if( zRef==0 ) return 0;
714 if( strchr(zRef,'%')!=0 ){
715 zToFree = fossil_strdup(zRef);
716 dehttpize(zToFree);
717 zRef = zToFree;
718 }
719 nBase = (int)strlen(g.zBaseURL);
720 if( fossil_strncmp(g.zBaseURL,zRef,nBase)!=0 ){
721
+2 -2
--- src/configure.c
+++ src/configure.c
@@ -986,11 +986,11 @@
986986
** you are doing! The --unset option only works if there is a PATTERN.
987987
** Probably you should run the command once without --unset to make sure
988988
** you know exactly what is being deleted.
989989
**
990990
** If not in an open check-out, use the -R REPO option to specify a
991
-** a repository.
991
+** repository.
992992
*/
993993
void test_var_list_cmd(void){
994994
Stmt q;
995995
int i, j;
996996
const char *zPattern = 0;
@@ -1083,11 +1083,11 @@
10831083
** Write the text of the VAR variable into FILE. If FILE is "-"
10841084
** or is omitted then output goes to standard output. VAR can be a
10851085
** GLOB pattern.
10861086
**
10871087
** If not in an open check-out, use the -R REPO option to specify a
1088
-** a repository.
1088
+** repository.
10891089
*/
10901090
void test_var_get_cmd(void){
10911091
const char *zVar;
10921092
const char *zFile;
10931093
int n;
10941094
--- src/configure.c
+++ src/configure.c
@@ -986,11 +986,11 @@
986 ** you are doing! The --unset option only works if there is a PATTERN.
987 ** Probably you should run the command once without --unset to make sure
988 ** you know exactly what is being deleted.
989 **
990 ** If not in an open check-out, use the -R REPO option to specify a
991 ** a repository.
992 */
993 void test_var_list_cmd(void){
994 Stmt q;
995 int i, j;
996 const char *zPattern = 0;
@@ -1083,11 +1083,11 @@
1083 ** Write the text of the VAR variable into FILE. If FILE is "-"
1084 ** or is omitted then output goes to standard output. VAR can be a
1085 ** GLOB pattern.
1086 **
1087 ** If not in an open check-out, use the -R REPO option to specify a
1088 ** a repository.
1089 */
1090 void test_var_get_cmd(void){
1091 const char *zVar;
1092 const char *zFile;
1093 int n;
1094
--- src/configure.c
+++ src/configure.c
@@ -986,11 +986,11 @@
986 ** you are doing! The --unset option only works if there is a PATTERN.
987 ** Probably you should run the command once without --unset to make sure
988 ** you know exactly what is being deleted.
989 **
990 ** If not in an open check-out, use the -R REPO option to specify a
991 ** repository.
992 */
993 void test_var_list_cmd(void){
994 Stmt q;
995 int i, j;
996 const char *zPattern = 0;
@@ -1083,11 +1083,11 @@
1083 ** Write the text of the VAR variable into FILE. If FILE is "-"
1084 ** or is omitted then output goes to standard output. VAR can be a
1085 ** GLOB pattern.
1086 **
1087 ** If not in an open check-out, use the -R REPO option to specify a
1088 ** repository.
1089 */
1090 void test_var_get_cmd(void){
1091 const char *zVar;
1092 const char *zFile;
1093 int n;
1094
+2 -2
--- src/configure.c
+++ src/configure.c
@@ -986,11 +986,11 @@
986986
** you are doing! The --unset option only works if there is a PATTERN.
987987
** Probably you should run the command once without --unset to make sure
988988
** you know exactly what is being deleted.
989989
**
990990
** If not in an open check-out, use the -R REPO option to specify a
991
-** a repository.
991
+** repository.
992992
*/
993993
void test_var_list_cmd(void){
994994
Stmt q;
995995
int i, j;
996996
const char *zPattern = 0;
@@ -1083,11 +1083,11 @@
10831083
** Write the text of the VAR variable into FILE. If FILE is "-"
10841084
** or is omitted then output goes to standard output. VAR can be a
10851085
** GLOB pattern.
10861086
**
10871087
** If not in an open check-out, use the -R REPO option to specify a
1088
-** a repository.
1088
+** repository.
10891089
*/
10901090
void test_var_get_cmd(void){
10911091
const char *zVar;
10921092
const char *zFile;
10931093
int n;
10941094
--- src/configure.c
+++ src/configure.c
@@ -986,11 +986,11 @@
986 ** you are doing! The --unset option only works if there is a PATTERN.
987 ** Probably you should run the command once without --unset to make sure
988 ** you know exactly what is being deleted.
989 **
990 ** If not in an open check-out, use the -R REPO option to specify a
991 ** a repository.
992 */
993 void test_var_list_cmd(void){
994 Stmt q;
995 int i, j;
996 const char *zPattern = 0;
@@ -1083,11 +1083,11 @@
1083 ** Write the text of the VAR variable into FILE. If FILE is "-"
1084 ** or is omitted then output goes to standard output. VAR can be a
1085 ** GLOB pattern.
1086 **
1087 ** If not in an open check-out, use the -R REPO option to specify a
1088 ** a repository.
1089 */
1090 void test_var_get_cmd(void){
1091 const char *zVar;
1092 const char *zFile;
1093 int n;
1094
--- src/configure.c
+++ src/configure.c
@@ -986,11 +986,11 @@
986 ** you are doing! The --unset option only works if there is a PATTERN.
987 ** Probably you should run the command once without --unset to make sure
988 ** you know exactly what is being deleted.
989 **
990 ** If not in an open check-out, use the -R REPO option to specify a
991 ** repository.
992 */
993 void test_var_list_cmd(void){
994 Stmt q;
995 int i, j;
996 const char *zPattern = 0;
@@ -1083,11 +1083,11 @@
1083 ** Write the text of the VAR variable into FILE. If FILE is "-"
1084 ** or is omitted then output goes to standard output. VAR can be a
1085 ** GLOB pattern.
1086 **
1087 ** If not in an open check-out, use the -R REPO option to specify a
1088 ** repository.
1089 */
1090 void test_var_get_cmd(void){
1091 const char *zVar;
1092 const char *zFile;
1093 int n;
1094
+3 -3
--- src/content.c
+++ src/content.c
@@ -703,11 +703,11 @@
703703
/*
704704
** COMMAND: test-content-put
705705
**
706706
** Usage: %fossil test-content-put [OPTIONS] FILE ...
707707
**
708
-** Read the content of all FILE argments and add them to the Blob
708
+** Read the content of all FILE arguments and add them to the Blob
709709
** table as a new artifact using a direct call to content_put().
710710
**
711711
** Options:
712712
**
713713
** --moderate Make corresponding entries to the MODREQ table
@@ -951,13 +951,13 @@
951951
}
952952
953953
/*
954954
** COMMAND: test-content-deltify
955955
**
956
-** Usage: %fossil RID SRCID SRCID ... [-force]
956
+** Usage: %fossil test-content-deltify [--force] RID SRCID SRCID...
957957
**
958
-** Convert the content at RID into a delta one of the from SRCIDs.
958
+** Convert the content at RID into a delta from one of the SRCIDs.
959959
*/
960960
void test_content_deltify_cmd(void){
961961
int nSrc;
962962
int *aSrc;
963963
int i;
964964
--- src/content.c
+++ src/content.c
@@ -703,11 +703,11 @@
703 /*
704 ** COMMAND: test-content-put
705 **
706 ** Usage: %fossil test-content-put [OPTIONS] FILE ...
707 **
708 ** Read the content of all FILE argments and add them to the Blob
709 ** table as a new artifact using a direct call to content_put().
710 **
711 ** Options:
712 **
713 ** --moderate Make corresponding entries to the MODREQ table
@@ -951,13 +951,13 @@
951 }
952
953 /*
954 ** COMMAND: test-content-deltify
955 **
956 ** Usage: %fossil RID SRCID SRCID ... [-force]
957 **
958 ** Convert the content at RID into a delta one of the from SRCIDs.
959 */
960 void test_content_deltify_cmd(void){
961 int nSrc;
962 int *aSrc;
963 int i;
964
--- src/content.c
+++ src/content.c
@@ -703,11 +703,11 @@
703 /*
704 ** COMMAND: test-content-put
705 **
706 ** Usage: %fossil test-content-put [OPTIONS] FILE ...
707 **
708 ** Read the content of all FILE arguments and add them to the Blob
709 ** table as a new artifact using a direct call to content_put().
710 **
711 ** Options:
712 **
713 ** --moderate Make corresponding entries to the MODREQ table
@@ -951,13 +951,13 @@
951 }
952
953 /*
954 ** COMMAND: test-content-deltify
955 **
956 ** Usage: %fossil test-content-deltify [--force] RID SRCID SRCID...
957 **
958 ** Convert the content at RID into a delta from one of the SRCIDs.
959 */
960 void test_content_deltify_cmd(void){
961 int nSrc;
962 int *aSrc;
963 int i;
964
+2 -2
--- src/db.c
+++ src/db.c
@@ -1787,11 +1787,11 @@
17871787
}
17881788
17891789
/*
17901790
** WEBPAGE: setseekey
17911791
**
1792
-** Sets the sets the saved database encryption key to one that gets passed
1792
+** Sets the saved database encryption key to one that gets passed
17931793
** via the "key" query string parameter. If the saved database encryption
17941794
** key has already been set, does nothing. This web page does not produce
17951795
** any output on success or failure. No permissions are required and none
17961796
** are checked (partially due to lack of encrypted database access).
17971797
**
@@ -4648,11 +4648,11 @@
46484648
** not a robot. Details depend on the value of the setting.
46494649
**
46504650
** (0) Off: No adjustments are made to the 'h' privilege based on
46514651
** the user agent.
46524652
**
4653
-** (1) UserAgent and Javascript: The the href= values of hyperlinks
4653
+** (1) UserAgent and Javascript: The href= values of hyperlinks
46544654
** initially point to /honeypot and are changed to point to the
46554655
** correct target by javascript that runs after the page loads.
46564656
** The auto-hyperlink-delay and auto-hyperlink-mouseover settings
46574657
** influence that javascript.
46584658
**
46594659
--- src/db.c
+++ src/db.c
@@ -1787,11 +1787,11 @@
1787 }
1788
1789 /*
1790 ** WEBPAGE: setseekey
1791 **
1792 ** Sets the sets the saved database encryption key to one that gets passed
1793 ** via the "key" query string parameter. If the saved database encryption
1794 ** key has already been set, does nothing. This web page does not produce
1795 ** any output on success or failure. No permissions are required and none
1796 ** are checked (partially due to lack of encrypted database access).
1797 **
@@ -4648,11 +4648,11 @@
4648 ** not a robot. Details depend on the value of the setting.
4649 **
4650 ** (0) Off: No adjustments are made to the 'h' privilege based on
4651 ** the user agent.
4652 **
4653 ** (1) UserAgent and Javascript: The the href= values of hyperlinks
4654 ** initially point to /honeypot and are changed to point to the
4655 ** correct target by javascript that runs after the page loads.
4656 ** The auto-hyperlink-delay and auto-hyperlink-mouseover settings
4657 ** influence that javascript.
4658 **
4659
--- src/db.c
+++ src/db.c
@@ -1787,11 +1787,11 @@
1787 }
1788
1789 /*
1790 ** WEBPAGE: setseekey
1791 **
1792 ** Sets the saved database encryption key to one that gets passed
1793 ** via the "key" query string parameter. If the saved database encryption
1794 ** key has already been set, does nothing. This web page does not produce
1795 ** any output on success or failure. No permissions are required and none
1796 ** are checked (partially due to lack of encrypted database access).
1797 **
@@ -4648,11 +4648,11 @@
4648 ** not a robot. Details depend on the value of the setting.
4649 **
4650 ** (0) Off: No adjustments are made to the 'h' privilege based on
4651 ** the user agent.
4652 **
4653 ** (1) UserAgent and Javascript: The href= values of hyperlinks
4654 ** initially point to /honeypot and are changed to point to the
4655 ** correct target by javascript that runs after the page loads.
4656 ** The auto-hyperlink-delay and auto-hyperlink-mouseover settings
4657 ** influence that javascript.
4658 **
4659
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -958,11 +958,11 @@
958958
improveReadability(zLeft, zRight, p);
959959
}
960960
961961
/*
962962
** COMMAND: test-line-diff
963
-** Usage: %fossil% test-line-diff STRING1 STRING2
963
+** Usage: %fossil test-line-diff STRING1 STRING2
964964
**
965965
** Show the differences between the two strings. Used for testing
966966
** the oneLineChange() routine in the diff logic.
967967
*/
968968
void test_line_diff(void){
969969
--- src/diff.c
+++ src/diff.c
@@ -958,11 +958,11 @@
958 improveReadability(zLeft, zRight, p);
959 }
960
961 /*
962 ** COMMAND: test-line-diff
963 ** Usage: %fossil% test-line-diff STRING1 STRING2
964 **
965 ** Show the differences between the two strings. Used for testing
966 ** the oneLineChange() routine in the diff logic.
967 */
968 void test_line_diff(void){
969
--- src/diff.c
+++ src/diff.c
@@ -958,11 +958,11 @@
958 improveReadability(zLeft, zRight, p);
959 }
960
961 /*
962 ** COMMAND: test-line-diff
963 ** Usage: %fossil test-line-diff STRING1 STRING2
964 **
965 ** Show the differences between the two strings. Used for testing
966 ** the oneLineChange() routine in the diff logic.
967 */
968 void test_line_diff(void){
969
+2 -2
--- src/dispatch.c
+++ src/dispatch.c
@@ -865,11 +865,11 @@
865865
** the main web server.
866866
**
867867
** Query parameters:
868868
**
869869
** name=CMD Show help for CMD where CMD is a command name or
870
-** or setting name. If CMD beings with "/" it is
870
+** setting name. If CMD begins with "/" it is
871871
** interpreted as a PAGE name.
872872
**
873873
** name=www/PAGE Show help for web page PAGE.
874874
**
875875
** name=/PAGE The initial "www/" on web-page help can be abbreviated as
@@ -1459,11 +1459,11 @@
14591459
** --utc Display times using UTC
14601460
** --vfs NAME Cause SQLite to use the NAME VFS
14611461
**
14621462
** Additional options available on most commands that use network I/O:
14631463
**
1464
-** --accept-any-cert Disable server SSL cdert validation. Accept any SSL
1464
+** --accept-any-cert Disable server SSL cert validation. Accept any SSL
14651465
** cert that the server provides. WARNING: Unsafe!
14661466
** Testing and debugging use only!
14671467
** --ipv4 Use only IPv4. Disable IPv6 support.
14681468
** --ipv6 Use only IPv6. Disable IPv4 support.
14691469
** --nosync Disable autosync for the current command.
14701470
--- src/dispatch.c
+++ src/dispatch.c
@@ -865,11 +865,11 @@
865 ** the main web server.
866 **
867 ** Query parameters:
868 **
869 ** name=CMD Show help for CMD where CMD is a command name or
870 ** or setting name. If CMD beings with "/" it is
871 ** interpreted as a PAGE name.
872 **
873 ** name=www/PAGE Show help for web page PAGE.
874 **
875 ** name=/PAGE The initial "www/" on web-page help can be abbreviated as
@@ -1459,11 +1459,11 @@
1459 ** --utc Display times using UTC
1460 ** --vfs NAME Cause SQLite to use the NAME VFS
1461 **
1462 ** Additional options available on most commands that use network I/O:
1463 **
1464 ** --accept-any-cert Disable server SSL cdert validation. Accept any SSL
1465 ** cert that the server provides. WARNING: Unsafe!
1466 ** Testing and debugging use only!
1467 ** --ipv4 Use only IPv4. Disable IPv6 support.
1468 ** --ipv6 Use only IPv6. Disable IPv4 support.
1469 ** --nosync Disable autosync for the current command.
1470
--- src/dispatch.c
+++ src/dispatch.c
@@ -865,11 +865,11 @@
865 ** the main web server.
866 **
867 ** Query parameters:
868 **
869 ** name=CMD Show help for CMD where CMD is a command name or
870 ** setting name. If CMD begins with "/" it is
871 ** interpreted as a PAGE name.
872 **
873 ** name=www/PAGE Show help for web page PAGE.
874 **
875 ** name=/PAGE The initial "www/" on web-page help can be abbreviated as
@@ -1459,11 +1459,11 @@
1459 ** --utc Display times using UTC
1460 ** --vfs NAME Cause SQLite to use the NAME VFS
1461 **
1462 ** Additional options available on most commands that use network I/O:
1463 **
1464 ** --accept-any-cert Disable server SSL cert validation. Accept any SSL
1465 ** cert that the server provides. WARNING: Unsafe!
1466 ** Testing and debugging use only!
1467 ** --ipv4 Use only IPv4. Disable IPv6 support.
1468 ** --ipv6 Use only IPv6. Disable IPv4 support.
1469 ** --nosync Disable autosync for the current command.
1470
+9 -2
--- src/file.c
+++ src/file.c
@@ -1252,11 +1252,18 @@
12521252
}
12531253
}
12541254
if( j>=0 ) z[j] = z[i];
12551255
j++;
12561256
}
1257
- if( j==0 ) z[j++] = '/';
1257
+ if( j<0 ){
1258
+ /* backup_dir() removed everything including the first component.
1259
+ ** Absolute "/.." still has z[0]=='/'; relative "a/.." is cwd. */
1260
+ if( z[0]=='/' ){ j = 0; z[j++] = '/'; }
1261
+ else { z[0] = '.'; j = 1; }
1262
+ }else if( j==0 ){
1263
+ z[j++] = '/';
1264
+ }
12581265
z[j] = 0;
12591266
return j;
12601267
}
12611268
12621269
/*
@@ -1465,11 +1472,11 @@
14651472
/*
14661473
** COMMAND: test-case-filename
14671474
**
14681475
** Usage: fossil test-case-filename DIRECTORY PATH PATH PATH ....
14691476
**
1470
-** All the PATH arguments (there must be one at least one) are pathnames
1477
+** All the PATH arguments (there must be at least one) are pathnames
14711478
** relative to DIRECTORY. This test command prints the OS-preferred name
14721479
** for each PATH in filesystems where case is not significant.
14731480
*/
14741481
void test_preferred_fn(void){
14751482
int i;
14761483
--- src/file.c
+++ src/file.c
@@ -1252,11 +1252,18 @@
1252 }
1253 }
1254 if( j>=0 ) z[j] = z[i];
1255 j++;
1256 }
1257 if( j==0 ) z[j++] = '/';
 
 
 
 
 
 
 
1258 z[j] = 0;
1259 return j;
1260 }
1261
1262 /*
@@ -1465,11 +1472,11 @@
1465 /*
1466 ** COMMAND: test-case-filename
1467 **
1468 ** Usage: fossil test-case-filename DIRECTORY PATH PATH PATH ....
1469 **
1470 ** All the PATH arguments (there must be one at least one) are pathnames
1471 ** relative to DIRECTORY. This test command prints the OS-preferred name
1472 ** for each PATH in filesystems where case is not significant.
1473 */
1474 void test_preferred_fn(void){
1475 int i;
1476
--- src/file.c
+++ src/file.c
@@ -1252,11 +1252,18 @@
1252 }
1253 }
1254 if( j>=0 ) z[j] = z[i];
1255 j++;
1256 }
1257 if( j<0 ){
1258 /* backup_dir() removed everything including the first component.
1259 ** Absolute "/.." still has z[0]=='/'; relative "a/.." is cwd. */
1260 if( z[0]=='/' ){ j = 0; z[j++] = '/'; }
1261 else { z[0] = '.'; j = 1; }
1262 }else if( j==0 ){
1263 z[j++] = '/';
1264 }
1265 z[j] = 0;
1266 return j;
1267 }
1268
1269 /*
@@ -1465,11 +1472,11 @@
1472 /*
1473 ** COMMAND: test-case-filename
1474 **
1475 ** Usage: fossil test-case-filename DIRECTORY PATH PATH PATH ....
1476 **
1477 ** All the PATH arguments (there must be at least one) are pathnames
1478 ** relative to DIRECTORY. This test command prints the OS-preferred name
1479 ** for each PATH in filesystems where case is not significant.
1480 */
1481 void test_preferred_fn(void){
1482 int i;
1483
+15 -7
--- src/forum.c
+++ src/forum.c
@@ -3471,19 +3471,27 @@
34713471
fossil_fatal("the --title option is required");
34723472
}
34733473
if( zFile==0 ){
34743474
fossil_fatal("the --content option is required");
34753475
}
3476
- if( zMarkup==0 || fossil_strcmp(zMarkup,"markdown")==0 ){
3477
- zMimetype = "text/x-markdown";
3478
- }else if( fossil_strcmp(zMarkup,"wiki")==0 ){
3479
- zMimetype = 0;
3480
- }else if( fossil_strcmp(zMarkup,"plaintext")==0 ){
3481
- zMimetype = "text/plain";
3482
- }else{
3476
+ if( zMarkup==0 ){
3477
+ zMimetype = wiki_guess_filename_mimetype(zFile, 0);
3478
+ if( !zMimetype ){
3479
+ fossil_fatal("Either use --markup <type> or a --content "
3480
+ "filename extension of (.md, .txt, .wiki) "
3481
+ "to specify the mime type.");
3482
+ zMimetype = DEFAULT_FORUM_MIMETYPE;
3483
+ }
3484
+ }else if( !wiki_is_valid_mimetype(zMarkup) ){
34833485
fossil_fatal("unknown --markup \"%s\". Should be one of: "
34843486
"markdown, wiki, plaintext", zMarkup);
3487
+ }else{
3488
+ zMimetype = wiki_filter_mimetypes(zMarkup)/*normalize short names*/;
3489
+ assert( zMimetype );
3490
+ }
3491
+ if( 0==fossil_strcmp(zMimetype, "text/x-fossil-wiki") ){
3492
+ zMimetype = 0 /* avoid setting N-card */;
34853493
}
34863494
if( fossil_strcmp(zFile,"-")==0 ){
34873495
blob_read_from_channel(&content, stdin, -1);
34883496
}else{
34893497
blob_read_from_file(&content, zFile, ExtFILE);
34903498
--- src/forum.c
+++ src/forum.c
@@ -3471,19 +3471,27 @@
3471 fossil_fatal("the --title option is required");
3472 }
3473 if( zFile==0 ){
3474 fossil_fatal("the --content option is required");
3475 }
3476 if( zMarkup==0 || fossil_strcmp(zMarkup,"markdown")==0 ){
3477 zMimetype = "text/x-markdown";
3478 }else if( fossil_strcmp(zMarkup,"wiki")==0 ){
3479 zMimetype = 0;
3480 }else if( fossil_strcmp(zMarkup,"plaintext")==0 ){
3481 zMimetype = "text/plain";
3482 }else{
 
 
3483 fossil_fatal("unknown --markup \"%s\". Should be one of: "
3484 "markdown, wiki, plaintext", zMarkup);
 
 
 
 
 
 
3485 }
3486 if( fossil_strcmp(zFile,"-")==0 ){
3487 blob_read_from_channel(&content, stdin, -1);
3488 }else{
3489 blob_read_from_file(&content, zFile, ExtFILE);
3490
--- src/forum.c
+++ src/forum.c
@@ -3471,19 +3471,27 @@
3471 fossil_fatal("the --title option is required");
3472 }
3473 if( zFile==0 ){
3474 fossil_fatal("the --content option is required");
3475 }
3476 if( zMarkup==0 ){
3477 zMimetype = wiki_guess_filename_mimetype(zFile, 0);
3478 if( !zMimetype ){
3479 fossil_fatal("Either use --markup <type> or a --content "
3480 "filename extension of (.md, .txt, .wiki) "
3481 "to specify the mime type.");
3482 zMimetype = DEFAULT_FORUM_MIMETYPE;
3483 }
3484 }else if( !wiki_is_valid_mimetype(zMarkup) ){
3485 fossil_fatal("unknown --markup \"%s\". Should be one of: "
3486 "markdown, wiki, plaintext", zMarkup);
3487 }else{
3488 zMimetype = wiki_filter_mimetypes(zMarkup)/*normalize short names*/;
3489 assert( zMimetype );
3490 }
3491 if( 0==fossil_strcmp(zMimetype, "text/x-fossil-wiki") ){
3492 zMimetype = 0 /* avoid setting N-card */;
3493 }
3494 if( fossil_strcmp(zFile,"-")==0 ){
3495 blob_read_from_channel(&content, stdin, -1);
3496 }else{
3497 blob_read_from_file(&content, zFile, ExtFILE);
3498
+3 -3
--- src/main.c
+++ src/main.c
@@ -2408,14 +2408,14 @@
24082408
**
24092409
** repolist When in "directory:" mode, display a page
24102410
** showing a list of available repositories if
24112411
** the URL is "/". Some control over the display
24122412
** is accomplished using environment variables.
2413
-** FOSSIL_REPOLIST_TITLE is the tital of the page.
2414
-** FOSSIL_REPOLIST_SHOW cause the "Description"
2413
+** FOSSIL_REPOLIST_TITLE is the title of the page.
2414
+** FOSSIL_REPOLIST_SHOW causes the "Description"
24152415
** column to display if it contains "description" as
2416
-** as a substring, and causes the Login-Group column
2416
+** a substring, and causes the Login-Group column
24172417
** to display if it contains the "login-group"
24182418
** substring.
24192419
**
24202420
** localauth Grant administrator privileges to connections
24212421
** from 127.0.0.1 or ::1.
24222422
--- src/main.c
+++ src/main.c
@@ -2408,14 +2408,14 @@
2408 **
2409 ** repolist When in "directory:" mode, display a page
2410 ** showing a list of available repositories if
2411 ** the URL is "/". Some control over the display
2412 ** is accomplished using environment variables.
2413 ** FOSSIL_REPOLIST_TITLE is the tital of the page.
2414 ** FOSSIL_REPOLIST_SHOW cause the "Description"
2415 ** column to display if it contains "description" as
2416 ** as a substring, and causes the Login-Group column
2417 ** to display if it contains the "login-group"
2418 ** substring.
2419 **
2420 ** localauth Grant administrator privileges to connections
2421 ** from 127.0.0.1 or ::1.
2422
--- src/main.c
+++ src/main.c
@@ -2408,14 +2408,14 @@
2408 **
2409 ** repolist When in "directory:" mode, display a page
2410 ** showing a list of available repositories if
2411 ** the URL is "/". Some control over the display
2412 ** is accomplished using environment variables.
2413 ** FOSSIL_REPOLIST_TITLE is the title of the page.
2414 ** FOSSIL_REPOLIST_SHOW causes the "Description"
2415 ** column to display if it contains "description" as
2416 ** a substring, and causes the Login-Group column
2417 ** to display if it contains the "login-group"
2418 ** substring.
2419 **
2420 ** localauth Grant administrator privileges to connections
2421 ** from 127.0.0.1 or ::1.
2422
+1 -1
--- src/name.c
+++ src/name.c
@@ -2213,11 +2213,11 @@
22132213
/*
22142214
** WEBPAGE: phantoms
22152215
**
22162216
** Show a list of all "phantom" artifacts that are not marked as "private".
22172217
**
2218
-** A "phantom" artifact is an artifact whose hash named appears in some
2218
+** A "phantom" artifact is an artifact whose hash name appears in some
22192219
** artifact but whose content is unknown. For example, if a manifest
22202220
** references a particular SHA3 hash of a file, but that SHA3 hash is
22212221
** not on the shunning list and is not in the database, then the file
22222222
** is a phantom. We know it exists, but we do not know its content.
22232223
**
22242224
--- src/name.c
+++ src/name.c
@@ -2213,11 +2213,11 @@
2213 /*
2214 ** WEBPAGE: phantoms
2215 **
2216 ** Show a list of all "phantom" artifacts that are not marked as "private".
2217 **
2218 ** A "phantom" artifact is an artifact whose hash named appears in some
2219 ** artifact but whose content is unknown. For example, if a manifest
2220 ** references a particular SHA3 hash of a file, but that SHA3 hash is
2221 ** not on the shunning list and is not in the database, then the file
2222 ** is a phantom. We know it exists, but we do not know its content.
2223 **
2224
--- src/name.c
+++ src/name.c
@@ -2213,11 +2213,11 @@
2213 /*
2214 ** WEBPAGE: phantoms
2215 **
2216 ** Show a list of all "phantom" artifacts that are not marked as "private".
2217 **
2218 ** A "phantom" artifact is an artifact whose hash name appears in some
2219 ** artifact but whose content is unknown. For example, if a manifest
2220 ** references a particular SHA3 hash of a file, but that SHA3 hash is
2221 ** not on the shunning list and is not in the database, then the file
2222 ** is a phantom. We know it exists, but we do not know its content.
2223 **
2224
+39 -3
--- src/sha1hard.c
+++ src/sha1hard.c
@@ -441,15 +441,40 @@
441441
#define sha1_bswap32(x) \
442442
{x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0xFF00FF); x = (x << 16) | (x >> 16);}
443443
444444
#define sha1_mix(W, t) (rotate_left(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1))
445445
446
-#if defined(BIGENDIAN)
447
- #define sha1_load(m, t) (m[t])
446
+/*
447
+** SHA1 message words are big-endian, so they must be byte-swapped on
448
+** little-endian hosts and loaded as-is on big-endian ones. Upstream
449
+** sha1dc has a large detection block for SHA1DC_BIGENDIAN. This is a
450
+** condensed form of it. SHA1DCInit() double-checks the result at
451
+** runtime so that a misdetection fails loudly instead of silently
452
+** producing wrong hashes.
453
+*/
454
+#if !defined(SHA1DC_BIGENDIAN) && !defined(SHA1DC_LITTLEENDIAN)
455
+# if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
456
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
457
+# define SHA1DC_BIGENDIAN 1
458
+# endif
459
+# elif defined(__BIG_ENDIAN__) || defined(__ARMEB__) \
460
+ || defined(__THUMBEB__) || defined(__AARCH64EB__) \
461
+ || defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) \
462
+ || defined(__ppc__) || defined(__powerpc__) || defined(_POWER) \
463
+ || defined(__sparc) || defined(__sparc__) || defined(__hppa__) \
464
+ || defined(__s390__) || defined(__m68k__)
465
+ /* __ppc__/__powerpc__ without __BYTE_ORDER__ means an old compiler,
466
+ ** which predates ppc64le, so big-endian is a safe assumption. */
467
+# define SHA1DC_BIGENDIAN 1
468
+# endif
469
+#endif
470
+
471
+#if defined(SHA1DC_BIGENDIAN)
472
+ #define sha1_load(m, t, temp) { temp = m[t]; }
448473
#else
449474
#define sha1_load(m, t, temp) { temp = m[t]; sha1_bswap32(temp); }
450
-#endif /*define(BIGENDIAN)*/
475
+#endif /*defined(SHA1DC_BIGENDIAN)*/
451476
452477
#define sha1_store(W, t, x) *(volatile uint32_t *)&W[t] = x
453478
454479
#define sha1_f1(b,c,d) ((d)^((b)&((c)^(d))))
455480
#define sha1_f2(b,c,d) ((b)^(c)^(d))
@@ -1324,10 +1349,21 @@
13241349
}
13251350
}
13261351
13271352
void SHA1DCInit(SHA1_CTX* ctx)
13281353
{
1354
+ static const union { unsigned char b[4]; uint32_t v; } e = {{0,1,2,3}};
1355
+#if defined(SHA1DC_BIGENDIAN)
1356
+ if( e.v!=0x00010203 )
1357
+#else
1358
+ if( e.v!=0x03020100 )
1359
+#endif
1360
+ {
1361
+ fprintf(stderr, "sha1hard.c: compile-time byte-order detection "
1362
+ "is wrong for this platform\n");
1363
+ abort();
1364
+ }
13291365
ctx->total = 0;
13301366
ctx->ihv[0] = 0x67452301;
13311367
ctx->ihv[1] = 0xEFCDAB89;
13321368
ctx->ihv[2] = 0x98BADCFE;
13331369
ctx->ihv[3] = 0x10325476;
13341370
--- src/sha1hard.c
+++ src/sha1hard.c
@@ -441,15 +441,40 @@
441 #define sha1_bswap32(x) \
442 {x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0xFF00FF); x = (x << 16) | (x >> 16);}
443
444 #define sha1_mix(W, t) (rotate_left(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1))
445
446 #if defined(BIGENDIAN)
447 #define sha1_load(m, t) (m[t])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448 #else
449 #define sha1_load(m, t, temp) { temp = m[t]; sha1_bswap32(temp); }
450 #endif /*define(BIGENDIAN)*/
451
452 #define sha1_store(W, t, x) *(volatile uint32_t *)&W[t] = x
453
454 #define sha1_f1(b,c,d) ((d)^((b)&((c)^(d))))
455 #define sha1_f2(b,c,d) ((b)^(c)^(d))
@@ -1324,10 +1349,21 @@
1324 }
1325 }
1326
1327 void SHA1DCInit(SHA1_CTX* ctx)
1328 {
 
 
 
 
 
 
 
 
 
 
 
1329 ctx->total = 0;
1330 ctx->ihv[0] = 0x67452301;
1331 ctx->ihv[1] = 0xEFCDAB89;
1332 ctx->ihv[2] = 0x98BADCFE;
1333 ctx->ihv[3] = 0x10325476;
1334
--- src/sha1hard.c
+++ src/sha1hard.c
@@ -441,15 +441,40 @@
441 #define sha1_bswap32(x) \
442 {x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0xFF00FF); x = (x << 16) | (x >> 16);}
443
444 #define sha1_mix(W, t) (rotate_left(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1))
445
446 /*
447 ** SHA1 message words are big-endian, so they must be byte-swapped on
448 ** little-endian hosts and loaded as-is on big-endian ones. Upstream
449 ** sha1dc has a large detection block for SHA1DC_BIGENDIAN. This is a
450 ** condensed form of it. SHA1DCInit() double-checks the result at
451 ** runtime so that a misdetection fails loudly instead of silently
452 ** producing wrong hashes.
453 */
454 #if !defined(SHA1DC_BIGENDIAN) && !defined(SHA1DC_LITTLEENDIAN)
455 # if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
456 # if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
457 # define SHA1DC_BIGENDIAN 1
458 # endif
459 # elif defined(__BIG_ENDIAN__) || defined(__ARMEB__) \
460 || defined(__THUMBEB__) || defined(__AARCH64EB__) \
461 || defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) \
462 || defined(__ppc__) || defined(__powerpc__) || defined(_POWER) \
463 || defined(__sparc) || defined(__sparc__) || defined(__hppa__) \
464 || defined(__s390__) || defined(__m68k__)
465 /* __ppc__/__powerpc__ without __BYTE_ORDER__ means an old compiler,
466 ** which predates ppc64le, so big-endian is a safe assumption. */
467 # define SHA1DC_BIGENDIAN 1
468 # endif
469 #endif
470
471 #if defined(SHA1DC_BIGENDIAN)
472 #define sha1_load(m, t, temp) { temp = m[t]; }
473 #else
474 #define sha1_load(m, t, temp) { temp = m[t]; sha1_bswap32(temp); }
475 #endif /*defined(SHA1DC_BIGENDIAN)*/
476
477 #define sha1_store(W, t, x) *(volatile uint32_t *)&W[t] = x
478
479 #define sha1_f1(b,c,d) ((d)^((b)&((c)^(d))))
480 #define sha1_f2(b,c,d) ((b)^(c)^(d))
@@ -1324,10 +1349,21 @@
1349 }
1350 }
1351
1352 void SHA1DCInit(SHA1_CTX* ctx)
1353 {
1354 static const union { unsigned char b[4]; uint32_t v; } e = {{0,1,2,3}};
1355 #if defined(SHA1DC_BIGENDIAN)
1356 if( e.v!=0x00010203 )
1357 #else
1358 if( e.v!=0x03020100 )
1359 #endif
1360 {
1361 fprintf(stderr, "sha1hard.c: compile-time byte-order detection "
1362 "is wrong for this platform\n");
1363 abort();
1364 }
1365 ctx->total = 0;
1366 ctx->ihv[0] = 0x67452301;
1367 ctx->ihv[1] = 0xEFCDAB89;
1368 ctx->ihv[2] = 0x98BADCFE;
1369 ctx->ihv[3] = 0x10325476;
1370
--- src/stash.c
+++ src/stash.c
@@ -232,10 +232,16 @@
232232
blob_reset(&orig);
233233
blob_reset(&disk);
234234
db_bind_blob(&ins, ":content", &content);
235235
}
236236
db_bind_int(&ins, ":islink", file_islink(zPath));
237
+#if !defined(_WIN32)
238
+ /* vfile.isexe is the baseline's bit, so a stash would lose an
239
+ ** exec-bit change. Take the file's own, as create_manifest() does.
240
+ ** On Windows, file_isexe() is always false, so keep vfile's. */
241
+ if( !deleted ) db_bind_int(&ins, ":isexe", file_isexe(zPath, RepoFILE));
242
+#endif
237243
db_step(&ins);
238244
db_reset(&ins);
239245
fossil_free(zPath);
240246
blob_reset(&content);
241247
}
242248
--- src/stash.c
+++ src/stash.c
@@ -232,10 +232,16 @@
232 blob_reset(&orig);
233 blob_reset(&disk);
234 db_bind_blob(&ins, ":content", &content);
235 }
236 db_bind_int(&ins, ":islink", file_islink(zPath));
 
 
 
 
 
 
237 db_step(&ins);
238 db_reset(&ins);
239 fossil_free(zPath);
240 blob_reset(&content);
241 }
242
--- src/stash.c
+++ src/stash.c
@@ -232,10 +232,16 @@
232 blob_reset(&orig);
233 blob_reset(&disk);
234 db_bind_blob(&ins, ":content", &content);
235 }
236 db_bind_int(&ins, ":islink", file_islink(zPath));
237 #if !defined(_WIN32)
238 /* vfile.isexe is the baseline's bit, so a stash would lose an
239 ** exec-bit change. Take the file's own, as create_manifest() does.
240 ** On Windows, file_isexe() is always false, so keep vfile's. */
241 if( !deleted ) db_bind_int(&ins, ":isexe", file_isexe(zPath, RepoFILE));
242 #endif
243 db_step(&ins);
244 db_reset(&ins);
245 fossil_free(zPath);
246 blob_reset(&content);
247 }
248
+2 -2
--- src/tag.c
+++ src/tag.c
@@ -435,11 +435,11 @@
435435
** with a P-card, it gets translated to the
436436
** oldest parent of that artifact and
437437
** --propagate is assumed. This is
438438
** most useful with forum posts, wiki
439439
** pages, and tech notes, where tags are
440
-** most easliy managed via their initial
440
+** most easily managed via their initial
441441
** version.
442442
**
443443
** The --date-override and --user-override options support
444444
** importing history from other SCM systems. DATETIME has
445445
** the form 'YYYY-MM-DD HH:MM:SS'.
@@ -490,11 +490,11 @@
490490
** scripting compatibility, the internal tag types "wiki-",
491491
** "tkt-", and "event-" (technote) are elided by default
492492
** unless the --raw or --prefix options are used.
493493
**
494494
** Options:
495
-** -v|--inverse Inverse the meaning of --tagtype TYPE
495
+** -v|--inverse Invert the meaning of --tagtype TYPE
496496
** --prefix List only tags with the given prefix
497497
** Fossil-internal prefixes include "sym-"
498498
** (branch name), "wiki-", "event-"
499499
** (technote), and "tkt-" (ticket). The
500500
** prefix is stripped from the resulting
501501
--- src/tag.c
+++ src/tag.c
@@ -435,11 +435,11 @@
435 ** with a P-card, it gets translated to the
436 ** oldest parent of that artifact and
437 ** --propagate is assumed. This is
438 ** most useful with forum posts, wiki
439 ** pages, and tech notes, where tags are
440 ** most easliy managed via their initial
441 ** version.
442 **
443 ** The --date-override and --user-override options support
444 ** importing history from other SCM systems. DATETIME has
445 ** the form 'YYYY-MM-DD HH:MM:SS'.
@@ -490,11 +490,11 @@
490 ** scripting compatibility, the internal tag types "wiki-",
491 ** "tkt-", and "event-" (technote) are elided by default
492 ** unless the --raw or --prefix options are used.
493 **
494 ** Options:
495 ** -v|--inverse Inverse the meaning of --tagtype TYPE
496 ** --prefix List only tags with the given prefix
497 ** Fossil-internal prefixes include "sym-"
498 ** (branch name), "wiki-", "event-"
499 ** (technote), and "tkt-" (ticket). The
500 ** prefix is stripped from the resulting
501
--- src/tag.c
+++ src/tag.c
@@ -435,11 +435,11 @@
435 ** with a P-card, it gets translated to the
436 ** oldest parent of that artifact and
437 ** --propagate is assumed. This is
438 ** most useful with forum posts, wiki
439 ** pages, and tech notes, where tags are
440 ** most easily managed via their initial
441 ** version.
442 **
443 ** The --date-override and --user-override options support
444 ** importing history from other SCM systems. DATETIME has
445 ** the form 'YYYY-MM-DD HH:MM:SS'.
@@ -490,11 +490,11 @@
490 ** scripting compatibility, the internal tag types "wiki-",
491 ** "tkt-", and "event-" (technote) are elided by default
492 ** unless the --raw or --prefix options are used.
493 **
494 ** Options:
495 ** -v|--inverse Invert the meaning of --tagtype TYPE
496 ** --prefix List only tags with the given prefix
497 ** Fossil-internal prefixes include "sym-"
498 ** (branch name), "wiki-", "event-"
499 ** (technote), and "tkt-" (ticket). The
500 ** prefix is stripped from the resulting
501
+3 -3
--- src/tar.c
+++ src/tar.c
@@ -915,21 +915,21 @@
915915
**
916916
** r=TAG TAG identifies the check-in that is turned into a
917917
** compressed tarball. The default value is the name of
918918
** the main branch (usually "trunk").
919919
** If r= is omitted and if the name= query parameter
920
-** contains one "/" character then the of part the
920
+** contains one "/" character then the part of the
921921
** name= value before the / becomes the TAG and the
922922
** part of the name= value after the / is the download
923923
** filename. If no check-in is specified by either
924924
** name= or r=, then the name of the main branch
925925
** (usually "trunk") is used.
926926
**
927927
** in=PATTERN Only include files that match the comma-separated
928928
** list of GLOB patterns in PATTERN, as with ex=
929929
**
930
-** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
930
+** ex=PATTERN Omit any file that matches PATTERN. PATTERN is a
931931
** comma-separated list of GLOB patterns, where each
932932
** pattern can optionally be quoted using ".." or '..'.
933933
** Any file matching both ex= and in= is excluded.
934934
**
935935
** Robot Defenses:
@@ -1108,11 +1108,11 @@
11081108
** The items in each group are:
11091109
**
11101110
** | COUNT TAG MAX_AGE COMMENT
11111111
**
11121112
** COUNT is the number of check-ins to match, starting with the most
1113
-** recent and working bacwards in time. Check-ins match if they contain
1113
+** recent and working backwards in time. Check-ins match if they contain
11141114
** the tag TAG. If MAX_AGE is not an empty string, then it specifies
11151115
** the maximum age of any matching check-in. COMMENT is an optional
11161116
** comment for each match.
11171117
**
11181118
** The special value of "OPEN-LEAF" for TAG matches any check-in that
11191119
--- src/tar.c
+++ src/tar.c
@@ -915,21 +915,21 @@
915 **
916 ** r=TAG TAG identifies the check-in that is turned into a
917 ** compressed tarball. The default value is the name of
918 ** the main branch (usually "trunk").
919 ** If r= is omitted and if the name= query parameter
920 ** contains one "/" character then the of part the
921 ** name= value before the / becomes the TAG and the
922 ** part of the name= value after the / is the download
923 ** filename. If no check-in is specified by either
924 ** name= or r=, then the name of the main branch
925 ** (usually "trunk") is used.
926 **
927 ** in=PATTERN Only include files that match the comma-separated
928 ** list of GLOB patterns in PATTERN, as with ex=
929 **
930 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
931 ** comma-separated list of GLOB patterns, where each
932 ** pattern can optionally be quoted using ".." or '..'.
933 ** Any file matching both ex= and in= is excluded.
934 **
935 ** Robot Defenses:
@@ -1108,11 +1108,11 @@
1108 ** The items in each group are:
1109 **
1110 ** | COUNT TAG MAX_AGE COMMENT
1111 **
1112 ** COUNT is the number of check-ins to match, starting with the most
1113 ** recent and working bacwards in time. Check-ins match if they contain
1114 ** the tag TAG. If MAX_AGE is not an empty string, then it specifies
1115 ** the maximum age of any matching check-in. COMMENT is an optional
1116 ** comment for each match.
1117 **
1118 ** The special value of "OPEN-LEAF" for TAG matches any check-in that
1119
--- src/tar.c
+++ src/tar.c
@@ -915,21 +915,21 @@
915 **
916 ** r=TAG TAG identifies the check-in that is turned into a
917 ** compressed tarball. The default value is the name of
918 ** the main branch (usually "trunk").
919 ** If r= is omitted and if the name= query parameter
920 ** contains one "/" character then the part of the
921 ** name= value before the / becomes the TAG and the
922 ** part of the name= value after the / is the download
923 ** filename. If no check-in is specified by either
924 ** name= or r=, then the name of the main branch
925 ** (usually "trunk") is used.
926 **
927 ** in=PATTERN Only include files that match the comma-separated
928 ** list of GLOB patterns in PATTERN, as with ex=
929 **
930 ** ex=PATTERN Omit any file that matches PATTERN. PATTERN is a
931 ** comma-separated list of GLOB patterns, where each
932 ** pattern can optionally be quoted using ".." or '..'.
933 ** Any file matching both ex= and in= is excluded.
934 **
935 ** Robot Defenses:
@@ -1108,11 +1108,11 @@
1108 ** The items in each group are:
1109 **
1110 ** | COUNT TAG MAX_AGE COMMENT
1111 **
1112 ** COUNT is the number of check-ins to match, starting with the most
1113 ** recent and working backwards in time. Check-ins match if they contain
1114 ** the tag TAG. If MAX_AGE is not an empty string, then it specifies
1115 ** the maximum age of any matching check-in. COMMENT is an optional
1116 ** comment for each match.
1117 **
1118 ** The special value of "OPEN-LEAF" for TAG matches any check-in that
1119
+3 -3
--- src/timeline.c
+++ src/timeline.c
@@ -1858,15 +1858,15 @@
18581858
** forks Show only forks and their children
18591859
** cherrypicks Show all cherrypicks
18601860
** ym=YYYYMM Show only events for the given year/month
18611861
** yw=YYYYWW Show only events for the given week of the given year
18621862
** yw=YYYYMMDD Show events for the week that includes the given day
1863
-** ymd=YYYYMMDD Show only events on the given day. The use "ymd=now"
1863
+** ymd=YYYYMMDD Show only events on the given day. Use "ymd=now"
18641864
** to see all changes for the current week. Add "z" at end
18651865
** to divide days at UTC instead of localtime days.
18661866
** Use ymd=YYYYMMDD-YYYYMMDD (with optional "z") for a range.
1867
-** year=YYYY Show only events on the given year. The use "year=0"
1867
+** year=YYYY Show only events on the given year. Use "year=0"
18681868
** to see all changes for the current year.
18691869
** days=N Show events over the previous N days
18701870
** datefmt=N Override the date format: 0=HH:MM, 1=HH:MM:SS,
18711871
** 2=YYYY-MM-DD HH:MM:SS, 3=YYMMDD HH:MM, and 4 means "off".
18721872
** bisect Show the check-ins that are in the current bisect
@@ -3984,11 +3984,11 @@
39843984
** PATH can be a file or a subdirectory.
39853985
** -q|--quiet Do not print notifications at the end of the timeline.
39863986
** -r|--reverse Show items in chronological order.
39873987
** -R REPO_FILE Specifies the repository db to use. Default is
39883988
** the current check-out's repository.
3989
-** -s|--summmary Truncate comments after the first blank line.
3989
+** -s|--summary Truncate comments after the first blank line.
39903990
** --sql Show the SQL used to generate the timeline
39913991
** -t|--type TYPE Output items from the given types only, such as:
39923992
** ci = file commits only
39933993
** e = technical notes only
39943994
** f = forum posts only
39953995
--- src/timeline.c
+++ src/timeline.c
@@ -1858,15 +1858,15 @@
1858 ** forks Show only forks and their children
1859 ** cherrypicks Show all cherrypicks
1860 ** ym=YYYYMM Show only events for the given year/month
1861 ** yw=YYYYWW Show only events for the given week of the given year
1862 ** yw=YYYYMMDD Show events for the week that includes the given day
1863 ** ymd=YYYYMMDD Show only events on the given day. The use "ymd=now"
1864 ** to see all changes for the current week. Add "z" at end
1865 ** to divide days at UTC instead of localtime days.
1866 ** Use ymd=YYYYMMDD-YYYYMMDD (with optional "z") for a range.
1867 ** year=YYYY Show only events on the given year. The use "year=0"
1868 ** to see all changes for the current year.
1869 ** days=N Show events over the previous N days
1870 ** datefmt=N Override the date format: 0=HH:MM, 1=HH:MM:SS,
1871 ** 2=YYYY-MM-DD HH:MM:SS, 3=YYMMDD HH:MM, and 4 means "off".
1872 ** bisect Show the check-ins that are in the current bisect
@@ -3984,11 +3984,11 @@
3984 ** PATH can be a file or a subdirectory.
3985 ** -q|--quiet Do not print notifications at the end of the timeline.
3986 ** -r|--reverse Show items in chronological order.
3987 ** -R REPO_FILE Specifies the repository db to use. Default is
3988 ** the current check-out's repository.
3989 ** -s|--summmary Truncate comments after the first blank line.
3990 ** --sql Show the SQL used to generate the timeline
3991 ** -t|--type TYPE Output items from the given types only, such as:
3992 ** ci = file commits only
3993 ** e = technical notes only
3994 ** f = forum posts only
3995
--- src/timeline.c
+++ src/timeline.c
@@ -1858,15 +1858,15 @@
1858 ** forks Show only forks and their children
1859 ** cherrypicks Show all cherrypicks
1860 ** ym=YYYYMM Show only events for the given year/month
1861 ** yw=YYYYWW Show only events for the given week of the given year
1862 ** yw=YYYYMMDD Show events for the week that includes the given day
1863 ** ymd=YYYYMMDD Show only events on the given day. Use "ymd=now"
1864 ** to see all changes for the current week. Add "z" at end
1865 ** to divide days at UTC instead of localtime days.
1866 ** Use ymd=YYYYMMDD-YYYYMMDD (with optional "z") for a range.
1867 ** year=YYYY Show only events on the given year. Use "year=0"
1868 ** to see all changes for the current year.
1869 ** days=N Show events over the previous N days
1870 ** datefmt=N Override the date format: 0=HH:MM, 1=HH:MM:SS,
1871 ** 2=YYYY-MM-DD HH:MM:SS, 3=YYMMDD HH:MM, and 4 means "off".
1872 ** bisect Show the check-ins that are in the current bisect
@@ -3984,11 +3984,11 @@
3984 ** PATH can be a file or a subdirectory.
3985 ** -q|--quiet Do not print notifications at the end of the timeline.
3986 ** -r|--reverse Show items in chronological order.
3987 ** -R REPO_FILE Specifies the repository db to use. Default is
3988 ** the current check-out's repository.
3989 ** -s|--summary Truncate comments after the first blank line.
3990 ** --sql Show the SQL used to generate the timeline
3991 ** -t|--type TYPE Output items from the given types only, such as:
3992 ** ci = file commits only
3993 ** e = technical notes only
3994 ** f = forum posts only
3995
+11 -1
--- src/utf8.c
+++ src/utf8.c
@@ -140,11 +140,21 @@
140140
#elif defined(__CYGWIN__)
141141
char *zOut;
142142
zOut = fossil_strdup(zPath);
143143
return zOut;
144144
#elif defined(__APPLE__) && !defined(WITHOUT_ICONV)
145
- char *zIn = (char*)zPath;
145
+ /* macOS gives us a pathname already in Apple's decomposed form. HFS+
146
+ ** stores names "fully decomposed and in canonical order" as per Unicode
147
+ ** 3.2, while APFS uses the same decomposed form but compares names
148
+ ** normalization-insensitively as per Unicode 9.0 basis (see Apple TN1150,
149
+ ** "Unicode Subtleties"; Apple File System Guide FAQ). iconv from
150
+ ** UTF-8-MAC recomposes the sequence to precomposed UTF-8. So this is a
151
+ ** composition pass, not full NFC. This function relies on the marks being
152
+ ** in canonical order as per a real macOS pathname, and it doesn't touch
153
+ ** characters Apple does not decompose, such as the U+F900-U+FAFF CJK
154
+ ** compatibility ideographs, again as per Apple documentation. */
155
+ char *zIn = (char*)zPath;
146156
char *zOut;
147157
iconv_t cd;
148158
size_t n, x;
149159
for(n=0; zIn[n]>0 && zIn[n]<=0x7f; n++){}
150160
if( zIn[n]!=0 && (cd = iconv_open("UTF-8", "UTF-8-MAC"))!=(iconv_t)-1 ){
151161
--- src/utf8.c
+++ src/utf8.c
@@ -140,11 +140,21 @@
140 #elif defined(__CYGWIN__)
141 char *zOut;
142 zOut = fossil_strdup(zPath);
143 return zOut;
144 #elif defined(__APPLE__) && !defined(WITHOUT_ICONV)
145 char *zIn = (char*)zPath;
 
 
 
 
 
 
 
 
 
 
146 char *zOut;
147 iconv_t cd;
148 size_t n, x;
149 for(n=0; zIn[n]>0 && zIn[n]<=0x7f; n++){}
150 if( zIn[n]!=0 && (cd = iconv_open("UTF-8", "UTF-8-MAC"))!=(iconv_t)-1 ){
151
--- src/utf8.c
+++ src/utf8.c
@@ -140,11 +140,21 @@
140 #elif defined(__CYGWIN__)
141 char *zOut;
142 zOut = fossil_strdup(zPath);
143 return zOut;
144 #elif defined(__APPLE__) && !defined(WITHOUT_ICONV)
145 /* macOS gives us a pathname already in Apple's decomposed form. HFS+
146 ** stores names "fully decomposed and in canonical order" as per Unicode
147 ** 3.2, while APFS uses the same decomposed form but compares names
148 ** normalization-insensitively as per Unicode 9.0 basis (see Apple TN1150,
149 ** "Unicode Subtleties"; Apple File System Guide FAQ). iconv from
150 ** UTF-8-MAC recomposes the sequence to precomposed UTF-8. So this is a
151 ** composition pass, not full NFC. This function relies on the marks being
152 ** in canonical order as per a real macOS pathname, and it doesn't touch
153 ** characters Apple does not decompose, such as the U+F900-U+FAFF CJK
154 ** compatibility ideographs, again as per Apple documentation. */
155 char *zIn = (char*)zPath;
156 char *zOut;
157 iconv_t cd;
158 size_t n, x;
159 for(n=0; zIn[n]>0 && zIn[n]<=0x7f; n++){}
160 if( zIn[n]!=0 && (cd = iconv_open("UTF-8", "UTF-8-MAC"))!=(iconv_t)-1 ){
161
+41 -12
--- src/wiki.c
+++ src/wiki.c
@@ -168,27 +168,56 @@
168168
"text/x-markdown", "Markdown", "markdown",
169169
"text/plain", "Plain Text", "plain"
170170
};
171171
172172
/*
173
-** Only allow certain mimetypes through.
174
-** All others become "text/x-fossil-wiki"
173
+** If zMimetype is one of the supported wiki content mimetypes or a
174
+** shorthand form of it, returns the full mimetype string, else
175
+** returns 0.
176
+*/
177
+const char * wiki_is_valid_mimetype(const char *zMimetype){
178
+ int i;
179
+ for(i=0; i<count(azStyles); i+=3){
180
+ if( fossil_strcmp(zMimetype,azStyles[i+2])==0
181
+ || fossil_strcmp(zMimetype,azStyles[i])==0 ){
182
+ return azStyles[i];
183
+ }
184
+ }
185
+ if( fossil_strcmp(zMimetype, "text/x-markdown")==0
186
+ || fossil_strcmp(zMimetype, "text/plain")==0 ){
187
+ return zMimetype;
188
+ }
189
+ if( fossil_strcmp(zMimetype, "plaintext")==0 ){
190
+ /* Inconsistent "plain" vs "plaintext" in some commands/API. */
191
+ return "text/plain";
192
+ }
193
+ return 0;
194
+}
195
+
196
+/*
197
+** Only allow certain mimetypes through. All others become
198
+** "text/x-fossil-wiki". See wiki_is_valid_mimetype().
175199
*/
176200
const char *wiki_filter_mimetypes(const char *zMimetype){
177201
if( zMimetype!=0 ){
178
- int i;
179
- for(i=0; i<count(azStyles); i+=3){
180
- if( fossil_strcmp(zMimetype,azStyles[i+2])==0 ){
181
- return azStyles[i];
182
- }
183
- }
184
- if( fossil_strcmp(zMimetype, "text/x-markdown")==0
185
- || fossil_strcmp(zMimetype, "text/plain")==0 ){
186
- return zMimetype;
202
+ zMimetype = wiki_is_valid_mimetype(zMimetype);
203
+ }
204
+ return zMimetype ? zMimetype : "text/x-fossil-wiki";
205
+}
206
+
207
+char const *wiki_guess_filename_mimetype(const char *zFilename,
208
+ const char *zDefault){
209
+ if( zFilename ){
210
+ if( 0==sqlite3_strglob("*.md", zFilename) ){
211
+ return "text/x-markdown";
212
+ }else if( 0==sqlite3_strglob("*.txt", zFilename) ){
213
+ return "text/plain";
214
+ }else if( 0==sqlite3_strglob("*.wiki", zFilename) ){
215
+ return "text/x-fossil-wiki";
187216
}
188217
}
189
- return "text/x-fossil-wiki";
218
+ return 0;
190219
}
191220
192221
/*
193222
** Render wiki text according to its mimetype.
194223
**
195224
--- src/wiki.c
+++ src/wiki.c
@@ -168,27 +168,56 @@
168 "text/x-markdown", "Markdown", "markdown",
169 "text/plain", "Plain Text", "plain"
170 };
171
172 /*
173 ** Only allow certain mimetypes through.
174 ** All others become "text/x-fossil-wiki"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175 */
176 const char *wiki_filter_mimetypes(const char *zMimetype){
177 if( zMimetype!=0 ){
178 int i;
179 for(i=0; i<count(azStyles); i+=3){
180 if( fossil_strcmp(zMimetype,azStyles[i+2])==0 ){
181 return azStyles[i];
182 }
183 }
184 if( fossil_strcmp(zMimetype, "text/x-markdown")==0
185 || fossil_strcmp(zMimetype, "text/plain")==0 ){
186 return zMimetype;
 
 
 
 
 
187 }
188 }
189 return "text/x-fossil-wiki";
190 }
191
192 /*
193 ** Render wiki text according to its mimetype.
194 **
195
--- src/wiki.c
+++ src/wiki.c
@@ -168,27 +168,56 @@
168 "text/x-markdown", "Markdown", "markdown",
169 "text/plain", "Plain Text", "plain"
170 };
171
172 /*
173 ** If zMimetype is one of the supported wiki content mimetypes or a
174 ** shorthand form of it, returns the full mimetype string, else
175 ** returns 0.
176 */
177 const char * wiki_is_valid_mimetype(const char *zMimetype){
178 int i;
179 for(i=0; i<count(azStyles); i+=3){
180 if( fossil_strcmp(zMimetype,azStyles[i+2])==0
181 || fossil_strcmp(zMimetype,azStyles[i])==0 ){
182 return azStyles[i];
183 }
184 }
185 if( fossil_strcmp(zMimetype, "text/x-markdown")==0
186 || fossil_strcmp(zMimetype, "text/plain")==0 ){
187 return zMimetype;
188 }
189 if( fossil_strcmp(zMimetype, "plaintext")==0 ){
190 /* Inconsistent "plain" vs "plaintext" in some commands/API. */
191 return "text/plain";
192 }
193 return 0;
194 }
195
196 /*
197 ** Only allow certain mimetypes through. All others become
198 ** "text/x-fossil-wiki". See wiki_is_valid_mimetype().
199 */
200 const char *wiki_filter_mimetypes(const char *zMimetype){
201 if( zMimetype!=0 ){
202 zMimetype = wiki_is_valid_mimetype(zMimetype);
203 }
204 return zMimetype ? zMimetype : "text/x-fossil-wiki";
205 }
206
207 char const *wiki_guess_filename_mimetype(const char *zFilename,
208 const char *zDefault){
209 if( zFilename ){
210 if( 0==sqlite3_strglob("*.md", zFilename) ){
211 return "text/x-markdown";
212 }else if( 0==sqlite3_strglob("*.txt", zFilename) ){
213 return "text/plain";
214 }else if( 0==sqlite3_strglob("*.wiki", zFilename) ){
215 return "text/x-fossil-wiki";
216 }
217 }
218 return 0;
219 }
220
221 /*
222 ** Render wiki text according to its mimetype.
223 **
224
+2 -2
--- src/zip.c
+++ src/zip.c
@@ -984,21 +984,21 @@
984984
**
985985
** r=TAG TAG identifies the check-in that is turned into an
986986
** SQL or ZIP archive. The default value is the name
987987
** of the main branch (usually "trunk").
988988
** If r= is omitted and if the name= query parameter
989
-** contains one "/" character then the of part the
989
+** contains one "/" character then the part of the
990990
** name= value before the / becomes the TAG and the
991991
** part of the name= value after the / is the download
992992
** filename. If no check-in is specified by either
993993
** name= or r=, then the name of the main branch
994994
** (usually "trunk") is used.
995995
**
996996
** in=PATTERN Only include files that match the comma-separated
997997
** list of GLOB patterns in PATTERN, as with ex=
998998
**
999
-** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
999
+** ex=PATTERN Omit any file that matches PATTERN. PATTERN is a
10001000
** comma-separated list of GLOB patterns, where each
10011001
** pattern can optionally be quoted using ".." or '..'.
10021002
** Any file matching both ex= and in= is excluded.
10031003
**
10041004
** Robot Defenses:
10051005
--- src/zip.c
+++ src/zip.c
@@ -984,21 +984,21 @@
984 **
985 ** r=TAG TAG identifies the check-in that is turned into an
986 ** SQL or ZIP archive. The default value is the name
987 ** of the main branch (usually "trunk").
988 ** If r= is omitted and if the name= query parameter
989 ** contains one "/" character then the of part the
990 ** name= value before the / becomes the TAG and the
991 ** part of the name= value after the / is the download
992 ** filename. If no check-in is specified by either
993 ** name= or r=, then the name of the main branch
994 ** (usually "trunk") is used.
995 **
996 ** in=PATTERN Only include files that match the comma-separated
997 ** list of GLOB patterns in PATTERN, as with ex=
998 **
999 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
1000 ** comma-separated list of GLOB patterns, where each
1001 ** pattern can optionally be quoted using ".." or '..'.
1002 ** Any file matching both ex= and in= is excluded.
1003 **
1004 ** Robot Defenses:
1005
--- src/zip.c
+++ src/zip.c
@@ -984,21 +984,21 @@
984 **
985 ** r=TAG TAG identifies the check-in that is turned into an
986 ** SQL or ZIP archive. The default value is the name
987 ** of the main branch (usually "trunk").
988 ** If r= is omitted and if the name= query parameter
989 ** contains one "/" character then the part of the
990 ** name= value before the / becomes the TAG and the
991 ** part of the name= value after the / is the download
992 ** filename. If no check-in is specified by either
993 ** name= or r=, then the name of the main branch
994 ** (usually "trunk") is used.
995 **
996 ** in=PATTERN Only include files that match the comma-separated
997 ** list of GLOB patterns in PATTERN, as with ex=
998 **
999 ** ex=PATTERN Omit any file that matches PATTERN. PATTERN is a
1000 ** comma-separated list of GLOB patterns, where each
1001 ** pattern can optionally be quoted using ".." or '..'.
1002 ** Any file matching both ex= and in= is excluded.
1003 **
1004 ** Robot Defenses:
1005

Keyboard Shortcuts

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