Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make the "fossil git export" command more restrictive about characters that it allows in tag names. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c9a592dde7fe493f16b110b4e87f5744 |
User & Date: | drh 2020-06-08 03:32:00 |
Context
2020-06-08
| ||
20:08 | Version 2.10.1 ... (check-in: 674782c7 user: drh tags: release, version-2.10.1, branch-2.10) | |
19:47 | Make the "fossil git export" command more restrictive about characters that it allows in tag names. ... (check-in: e8c6cd2c user: drh tags: branch-2.11) | |
12:10 | Update the built-in SQLite to the latest trunk version for testing. ... (check-in: 3ab64c5a user: drh tags: trunk) | |
03:32 | Make the "fossil git export" command more restrictive about characters that it allows in tag names. ... (check-in: c9a592dd user: drh tags: trunk) | |
2020-06-07
| ||
18:20 | Update custom Makefile for MinGW. ... (check-in: 81960e1f user: mistachkin tags: trunk) | |
Changes
Changes to src/export.c.
︙ | ︙ | |||
880 881 882 883 884 885 886 | ** tag names into "_". */ static void gitmirror_sanitize_name(char *z){ static unsigned char aSafe[] = { /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | ** tag names into "_". */ static void gitmirror_sanitize_name(char *z){ static unsigned char aSafe[] = { /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, /* 2x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, /* 3x */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, /* 5x */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, /* 7x */ }; unsigned char *zu = (unsigned char*)z; int i; for(i=0; zu[i]; i++){ if( zu[i]>0x7f || !aSafe[zu[i]] ){ zu[i] = '_'; }else if( zu[i]=='/' && (i==0 || zu[i+1]==0 || zu[i+1]=='/') ){ zu[i] = '_'; }else if( zu[i]=='.' && (zu[i+1]==0 || zu[i+1]=='.' || (i>0 && zu[i-1]=='.')) ){ zu[i] = '_'; } } } /* ** COMMAND: test-sanitize-name ** ** Usage: %fossil ARG... ** ** This sanitizes each argument and make it part of an "echo" command ** run by the shell. */ void test_sanitize_name_cmd(void){ sqlite3_str *pStr; int i; char *zCmd; pStr = sqlite3_str_new(0); sqlite3_str_appendall(pStr, "echo"); for(i=2; i<g.argc; i++){ char *z = fossil_strdup(g.argv[i]); gitmirror_sanitize_name(z); sqlite3_str_appendf(pStr, " \"%s\"", z); fossil_free(z); } zCmd = sqlite3_str_finish(pStr); fossil_print("Command: %s\n", zCmd); fossil_system(zCmd); sqlite3_free(zCmd); } /* ** Quote a filename as a C-style string using \\ and \" if necessary. ** If quoting is not necessary, just return a copy of the input string. ** ** The return value is a held in memory obtained from fossil_malloc() ** and must be freed by the caller. |
︙ | ︙ |