Fossil SCM

Hostname prefix on the repository name for the "fossil ui" command must be at least two characters in length, to avoid confusing it with a drive letter on windows.

drh 2021-07-12 15:13 trunk
Commit 385344eff7b03638c70cd940b9d2323b01654caf3565fd145e616c616dca805b
1 file changed +4 -1
+4 -1
--- src/file.c
+++ src/file.c
@@ -923,21 +923,24 @@
923923
** Remote files look like: "HOST:PATH" or "USER@HOST:PATH". Host must
924924
** be a valid hostname, meaning it must follow these rules:
925925
**
926926
** * Only characters [-.a-zA-Z0-9]. No spaces or other punctuation
927927
** * Does not begin or end with -
928
+** * Name is two or more characters long (otherwise it might be
929
+** confused with a drive-letter on Windows).
928930
**
929
-** The USER section, it it exists, must not contain the '@' character.
931
+** The USER section, if it exists, must not contain the '@' character.
930932
*/
931933
const char *file_skip_userhost(const char *zIn){
932934
const char *zTail;
933935
int n, i;
934936
if( zIn[0]==':' ) return 0;
935937
zTail = strchr(zIn, ':');
936938
if( zTail==0 ) return 0;
937939
if( zTail - zIn > 10000 ) return 0;
938940
n = (int)(zTail - zIn);
941
+ if( n<2 ) return 0;
939942
if( zIn[n-1]=='-' || zIn[n-1]=='.' ) return 0;
940943
for(i=n-1; i>0 && zIn[i-1]!='@'; i--){
941944
if( !fossil_isalnum(zIn[i]) && zIn[i]!='-' && zIn[i]!='.' ) return 0;
942945
}
943946
if( zIn[i]=='-' || zIn[i]=='.' || i==1 ) return 0;
944947
--- src/file.c
+++ src/file.c
@@ -923,21 +923,24 @@
923 ** Remote files look like: "HOST:PATH" or "USER@HOST:PATH". Host must
924 ** be a valid hostname, meaning it must follow these rules:
925 **
926 ** * Only characters [-.a-zA-Z0-9]. No spaces or other punctuation
927 ** * Does not begin or end with -
 
 
928 **
929 ** The USER section, it it exists, must not contain the '@' character.
930 */
931 const char *file_skip_userhost(const char *zIn){
932 const char *zTail;
933 int n, i;
934 if( zIn[0]==':' ) return 0;
935 zTail = strchr(zIn, ':');
936 if( zTail==0 ) return 0;
937 if( zTail - zIn > 10000 ) return 0;
938 n = (int)(zTail - zIn);
 
939 if( zIn[n-1]=='-' || zIn[n-1]=='.' ) return 0;
940 for(i=n-1; i>0 && zIn[i-1]!='@'; i--){
941 if( !fossil_isalnum(zIn[i]) && zIn[i]!='-' && zIn[i]!='.' ) return 0;
942 }
943 if( zIn[i]=='-' || zIn[i]=='.' || i==1 ) return 0;
944
--- src/file.c
+++ src/file.c
@@ -923,21 +923,24 @@
923 ** Remote files look like: "HOST:PATH" or "USER@HOST:PATH". Host must
924 ** be a valid hostname, meaning it must follow these rules:
925 **
926 ** * Only characters [-.a-zA-Z0-9]. No spaces or other punctuation
927 ** * Does not begin or end with -
928 ** * Name is two or more characters long (otherwise it might be
929 ** confused with a drive-letter on Windows).
930 **
931 ** The USER section, if it exists, must not contain the '@' character.
932 */
933 const char *file_skip_userhost(const char *zIn){
934 const char *zTail;
935 int n, i;
936 if( zIn[0]==':' ) return 0;
937 zTail = strchr(zIn, ':');
938 if( zTail==0 ) return 0;
939 if( zTail - zIn > 10000 ) return 0;
940 n = (int)(zTail - zIn);
941 if( n<2 ) return 0;
942 if( zIn[n-1]=='-' || zIn[n-1]=='.' ) return 0;
943 for(i=n-1; i>0 && zIn[i-1]!='@'; i--){
944 if( !fossil_isalnum(zIn[i]) && zIn[i]!='-' && zIn[i]!='.' ) return 0;
945 }
946 if( zIn[i]=='-' || zIn[i]=='.' || i==1 ) return 0;
947

Keyboard Shortcuts

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