Fossil

Check-in [23679d72]
Login

Check-in [23679d72]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the URL-to-repository-filename converter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 23679d720dc49920abbe8a5ce98ad8af6dd558a4ae17c1447133ab110e46e94d
User & Date: drh 2020-11-02 18:11:16
Context
2020-11-04
00:43
Add 'contact' subcommand to the 'fossil user' command. This enables changing contact information for a given user. If no argument is passed, this displays the current contact info of the passed in username. ... (check-in: 03f0a495 user: jamsek tags: trunk)
2020-11-02
18:11
Improvements to the URL-to-repository-filename converter. ... (check-in: 23679d72 user: drh tags: trunk)
14:58
Add the "test-url-basename" command for testing the url_to_repo_basename() function. Use this to try to reproduce the behavior reported on forum post 3e6f96bffc, without success. ... (check-in: 8d9ea283 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/url.c.

647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
*/
char *url_to_repo_basename(const char *zUrl){
  const char *zTail = 0;
  int i;
  if( zUrl==0 ) return 0;
  for(i=0; zUrl[i]; i++){
    if( zUrl[i]=='?' ) break;
    if( zUrl[i]=='/' && zUrl[i+1]!=0 ) zTail = &zUrl[i+1];
  }
  if( zTail==0 ) return 0;
  if( sqlite3_strnicmp(zTail, "www.", 4)==0 ) zTail += 4;
  if( zTail[i]==0 ) return 0;
  for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
  if( i==0 ) return 0;
  return mprintf("%.*s", i, zTail);
}

/*
** COMMAND: test-url-basename







|



|







647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
*/
char *url_to_repo_basename(const char *zUrl){
  const char *zTail = 0;
  int i;
  if( zUrl==0 ) return 0;
  for(i=0; zUrl[i]; i++){
    if( zUrl[i]=='?' ) break;
    if( (zUrl[i]=='/' || zUrl[i]=='@') && zUrl[i+1]!=0 ) zTail = &zUrl[i+1];
  }
  if( zTail==0 ) return 0;
  if( sqlite3_strnicmp(zTail, "www.", 4)==0 ) zTail += 4;
  if( zTail[0]==0 ) return 0;
  for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
  if( i==0 ) return 0;
  return mprintf("%.*s", i, zTail);
}

/*
** COMMAND: test-url-basename