Fossil SCM
Allow 8 *or more* digits in the "-v00000000" string that can be added to builtin filenames.
Commit
81af7db0a3470cf7d7d779a47c3eee65980c006712fd8f282866afa3e08f7d21
Parent
95b8022b0c810ef…
1 file changed
+5
-4
+5
-4
| --- src/builtin.c | ||
| +++ src/builtin.c | ||
| @@ -56,23 +56,24 @@ | ||
| 56 | 56 | ** Return a pointer to built-in content |
| 57 | 57 | ** |
| 58 | 58 | ** If the filename contains "-vNNNNNNNN" just before the final file |
| 59 | 59 | ** suffix, where each N is a random digit, then omit that part of the |
| 60 | 60 | ** filename before doing the lookup. The extra -vNNNNNNNN was added |
| 61 | -** to defeat overly aggressive caching by web browsers. | |
| 61 | +** to defeat overly aggressive caching by web browsers. There must be | |
| 62 | +** at least 8 digits in NNNNNNNN but more than 8 are allowed. | |
| 62 | 63 | */ |
| 63 | 64 | const unsigned char *builtin_file(const char *zFilename, int *piSize){ |
| 64 | 65 | int i = builtin_file_index(zFilename); |
| 65 | 66 | if( i>=0 ){ |
| 66 | 67 | if( piSize ) *piSize = aBuiltinFiles[i].nByte; |
| 67 | 68 | return aBuiltinFiles[i].pData; |
| 68 | 69 | }else{ |
| 69 | 70 | char *zV = strstr(zFilename, "-v"); |
| 70 | 71 | if( zV!=0 ){ |
| 71 | - for(i=0; i<8 && fossil_isdigit(zV[i+2]); i++){} | |
| 72 | - if( i==8 && zV[10]=='.' ){ | |
| 73 | - char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+10); | |
| 72 | + for(i=0; fossil_isdigit(zV[i+2]); i++){} | |
| 73 | + if( i>=8 && zV[i+2]=='.' ){ | |
| 74 | + char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+i+2); | |
| 74 | 75 | const unsigned char *pRes = builtin_file(zNew, piSize); |
| 75 | 76 | fossil_free(zNew); |
| 76 | 77 | return pRes; |
| 77 | 78 | } |
| 78 | 79 | } |
| 79 | 80 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -56,23 +56,24 @@ | |
| 56 | ** Return a pointer to built-in content |
| 57 | ** |
| 58 | ** If the filename contains "-vNNNNNNNN" just before the final file |
| 59 | ** suffix, where each N is a random digit, then omit that part of the |
| 60 | ** filename before doing the lookup. The extra -vNNNNNNNN was added |
| 61 | ** to defeat overly aggressive caching by web browsers. |
| 62 | */ |
| 63 | const unsigned char *builtin_file(const char *zFilename, int *piSize){ |
| 64 | int i = builtin_file_index(zFilename); |
| 65 | if( i>=0 ){ |
| 66 | if( piSize ) *piSize = aBuiltinFiles[i].nByte; |
| 67 | return aBuiltinFiles[i].pData; |
| 68 | }else{ |
| 69 | char *zV = strstr(zFilename, "-v"); |
| 70 | if( zV!=0 ){ |
| 71 | for(i=0; i<8 && fossil_isdigit(zV[i+2]); i++){} |
| 72 | if( i==8 && zV[10]=='.' ){ |
| 73 | char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+10); |
| 74 | const unsigned char *pRes = builtin_file(zNew, piSize); |
| 75 | fossil_free(zNew); |
| 76 | return pRes; |
| 77 | } |
| 78 | } |
| 79 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -56,23 +56,24 @@ | |
| 56 | ** Return a pointer to built-in content |
| 57 | ** |
| 58 | ** If the filename contains "-vNNNNNNNN" just before the final file |
| 59 | ** suffix, where each N is a random digit, then omit that part of the |
| 60 | ** filename before doing the lookup. The extra -vNNNNNNNN was added |
| 61 | ** to defeat overly aggressive caching by web browsers. There must be |
| 62 | ** at least 8 digits in NNNNNNNN but more than 8 are allowed. |
| 63 | */ |
| 64 | const unsigned char *builtin_file(const char *zFilename, int *piSize){ |
| 65 | int i = builtin_file_index(zFilename); |
| 66 | if( i>=0 ){ |
| 67 | if( piSize ) *piSize = aBuiltinFiles[i].nByte; |
| 68 | return aBuiltinFiles[i].pData; |
| 69 | }else{ |
| 70 | char *zV = strstr(zFilename, "-v"); |
| 71 | if( zV!=0 ){ |
| 72 | for(i=0; fossil_isdigit(zV[i+2]); i++){} |
| 73 | if( i>=8 && zV[i+2]=='.' ){ |
| 74 | char *zNew = mprintf("%.*s%s", (int)(zV-zFilename), zFilename, zV+i+2); |
| 75 | const unsigned char *pRes = builtin_file(zNew, piSize); |
| 76 | fossil_free(zNew); |
| 77 | return pRes; |
| 78 | } |
| 79 | } |
| 80 |