Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Allow backslash in card filenames without causing a SYNTAX error in card parsing. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | allow-backslash-in-card-filename |
| Files: | files | file ages | folders |
| SHA1: |
0a242574208c2f370d28258f4fcea370 |
| User & Date: | jan.nijtmans 2012-12-19 08:24:36.362 |
Context
|
2013-01-11
| ||
| 12:28 | merge trunk check-in: 6e9e6436a6 user: jan.nijtmans tags: allow-backslash-in-card-filename | |
|
2012-12-20
| ||
| 22:59 | Allow backslash in filenames on UNIX (experiment) Closed-Leaf check-in: c3d74f4f63 user: jan.nijtmans tags: allow-backslash-on-unix | |
|
2012-12-19
| ||
| 08:24 | Allow backslash in card filenames without causing a SYNTAX error in card parsing. check-in: 0a24257420 user: jan.nijtmans tags: allow-backslash-in-card-filename | |
|
2012-12-18
| ||
| 21:04 | Fix a couple typos in comments. check-in: 55a28e7f5a user: mistachkin tags: trunk | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
481 482 483 484 485 486 487 | /* ** Return true if the filename given is a valid filename for ** a file in a repository. Valid filenames follow all of the ** following rules: ** ** * Does not begin with "/" ** * Does not contain any path element named "." or ".." | < | | | < > | | | | | | | | | | | | < < < < | | | | | | | | | | < | | > | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
/*
** Return true if the filename given is a valid filename for
** a file in a repository. Valid filenames follow all of the
** following rules:
**
** * Does not begin with "/"
** * Does not contain any path element named "." or ".."
** * Does not end with "/".
** * Does not contain two or more "/" characters in a row.
** * Contains at least one character
**
** Invalid UTF8 characters and "\". result in a false return if
** bStrictUtf8 is true. If bStrictUtf8 is false, invalid UTF8
** characters and "\" are silently ignored.
*/
int file_is_simple_pathname(const char *z, int bStrictUtf8){
int i;
char c = z[0];
if( c=='/' || c==0 ) return 0;
if( c=='.' ){
if( z[1]=='/' || z[1]==0 ) return 0;
if( z[1]=='.' && (z[2]=='/' || z[2]==0) ) return 0;
}
for(i=0; (c=z[i])!=0; i++){
if( bStrictUtf8 ){
if( c & 0x80 ){
if( (c & 0xf0) == 0xf0 ) {
/* Unicode characters > U+FFFF are not supported.
* Windows XP and earlier cannot handle them.
*/
return 0;
}
if( (c & 0xf0) == 0xe0 ) {
/* This is a 3-byte UTF-8 character */
if ( (c & 0xfe) == 0xee ){
/* Range U+E000 - U+FFFF (Starting with 0xee or 0xef in UTF-8 ) */
if ( !(c & 1) || ((z[i+1] & 0xff) < 0xa4) ){
/* Unicode character in the range U+E000 - U+F8FF are for
* private use, they shouldn't occur in filenames. */
return 0;
}
} else if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){
/* Unicode character in the range U+D800 - U+DFFF are for
* surrogate pairs, they shouldn't occur in filenames. */
return 0;
}
}
}else if( c=='\\' ){
return 0;
}
}
if( c=='/' ){
if( z[i+1]=='/' ) return 0;
if( z[i+1]=='.' ){
if( z[i+2]=='/' || z[i+2]==0 ) return 0;
if( z[i+2]=='.' && (z[i+3]=='/' || z[i+3]==0) ) return 0;
}
|
| ︙ | ︙ |