Fossil SCM

When generating a repository name from the URL, include parsing of port to avoid undesirable behavior discovered in [forum:4409f66dae988dc5] in which the parser doesn't handle single-label host names which include a port (with or without a final slash).

andybradford 2021-09-29 07:27 trunk
Commit 000f80213eb639b4b108c6a60071360a2c220da40a7e23dad086439ed09ef765
1 file changed +2 -1
+2 -1
--- src/url.c
+++ src/url.c
@@ -677,11 +677,12 @@
677677
** But don't remove the "www." prefix if what follows is the suffix.
678678
** forum:/forumpost/74e111a2ee */
679679
zTail += 4;
680680
}
681681
if( zTail[0]==0 ) return 0;
682
- for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
682
+ for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?' &&
683
+ zTail[i]!=':' && zTail[i]!='/'; i++){}
683684
if( i==0 ) return 0;
684685
return mprintf("%.*s", i, zTail);
685686
}
686687
687688
/*
688689
--- src/url.c
+++ src/url.c
@@ -677,11 +677,12 @@
677 ** But don't remove the "www." prefix if what follows is the suffix.
678 ** forum:/forumpost/74e111a2ee */
679 zTail += 4;
680 }
681 if( zTail[0]==0 ) return 0;
682 for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
 
683 if( i==0 ) return 0;
684 return mprintf("%.*s", i, zTail);
685 }
686
687 /*
688
--- src/url.c
+++ src/url.c
@@ -677,11 +677,12 @@
677 ** But don't remove the "www." prefix if what follows is the suffix.
678 ** forum:/forumpost/74e111a2ee */
679 zTail += 4;
680 }
681 if( zTail[0]==0 ) return 0;
682 for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?' &&
683 zTail[i]!=':' && zTail[i]!='/'; i++){}
684 if( i==0 ) return 0;
685 return mprintf("%.*s", i, zTail);
686 }
687
688 /*
689

Keyboard Shortcuts

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