Fossil SCM
In /timeline, if "tl=" or similar contains a GLOB pattern, and no "ms=" is specified, default the match style to "glob" instead of "brlist".
Commit
1cfc5d6b4dcc29bf8453d4657f4ecd66879a82cda0a5df5551fd14f9d2c2a588
Parent
a1a4fc248b25335…
1 file changed
+25
-12
+25
-12
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1813,23 +1813,29 @@ | ||
| 1813 | 1813 | |
| 1814 | 1814 | /* Check for tl=TAGLIST and rl=TAGLIST which are abbreviations for |
| 1815 | 1815 | ** t=TAGLIST&ms=brlist and r=TAGLIST&ms=brlist repectively. */ |
| 1816 | 1816 | if( zBrName==0 && zTagName==0 ){ |
| 1817 | 1817 | const char *z; |
| 1818 | + const char *zPattern = 0; | |
| 1818 | 1819 | if( (z = P("tl"))!=0 ){ |
| 1819 | - zTagName = z; | |
| 1820 | - if( zMatchStyle==0 ) zMatchStyle = "brlist"; | |
| 1821 | - }else | |
| 1822 | - if( (z = P("rl"))!=0 ){ | |
| 1823 | - zBrName = z; | |
| 1820 | + zPattern = zTagName = z; | |
| 1821 | + }else if( (z = P("rl"))!=0 ){ | |
| 1822 | + zPattern = zBrName = z; | |
| 1824 | 1823 | if( related==0 ) related = 1; |
| 1825 | - if( zMatchStyle==0 ) zMatchStyle = "brlist"; | |
| 1826 | - }else | |
| 1827 | - if( (z = P("ml"))!=0 ){ | |
| 1828 | - zBrName = z; | |
| 1824 | + }else if( (z = P("ml"))!=0 ){ | |
| 1825 | + zPattern = zBrName = z; | |
| 1829 | 1826 | if( related==0 ) related = 2; |
| 1830 | - if( zMatchStyle==0 ) zMatchStyle = "brlist"; | |
| 1827 | + } | |
| 1828 | + if( zPattern!=0 && zMatchStyle==0 ){ | |
| 1829 | + /* If there was no ms= query parameter, set the match style to | |
| 1830 | + ** "glob" if the pattern appears to contain GLOB character, or | |
| 1831 | + ** "brlist" if it does not. */ | |
| 1832 | + if( strpbrk(zPattern,"*[?") ){ | |
| 1833 | + zMatchStyle = "glob"; | |
| 1834 | + }else{ | |
| 1835 | + zMatchStyle = "brlist"; | |
| 1836 | + } | |
| 1831 | 1837 | } |
| 1832 | 1838 | } |
| 1833 | 1839 | |
| 1834 | 1840 | /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */ |
| 1835 | 1841 | if( zBrName ){ |
| @@ -2919,12 +2925,19 @@ | ||
| 2919 | 2925 | @ ↑</a> |
| 2920 | 2926 | } |
| 2921 | 2927 | cgi_check_for_malice(); |
| 2922 | 2928 | { |
| 2923 | 2929 | Matcher *pLeftBranch; |
| 2924 | - if( P("sl")!=0 ){ | |
| 2925 | - pLeftBranch = match_create(zMatchStyle?matchStyle:MS_BRLIST, P("sl")); | |
| 2930 | + const char *zPattern = P("sl"); | |
| 2931 | + if( zPattern!=0 ){ | |
| 2932 | + MatchStyle ms; | |
| 2933 | + if( zMatchStyle!=0 ){ | |
| 2934 | + ms = matchStyle; | |
| 2935 | + }else{ | |
| 2936 | + ms = strpbrk(zPattern,"*[?")!=0 ? MS_GLOB : MS_BRLIST; | |
| 2937 | + } | |
| 2938 | + pLeftBranch = match_create(ms,zPattern); | |
| 2926 | 2939 | }else{ |
| 2927 | 2940 | pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName); |
| 2928 | 2941 | } |
| 2929 | 2942 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 2930 | 2943 | selectedRid, secondaryRid, 0); |
| 2931 | 2944 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1813,23 +1813,29 @@ | |
| 1813 | |
| 1814 | /* Check for tl=TAGLIST and rl=TAGLIST which are abbreviations for |
| 1815 | ** t=TAGLIST&ms=brlist and r=TAGLIST&ms=brlist repectively. */ |
| 1816 | if( zBrName==0 && zTagName==0 ){ |
| 1817 | const char *z; |
| 1818 | if( (z = P("tl"))!=0 ){ |
| 1819 | zTagName = z; |
| 1820 | if( zMatchStyle==0 ) zMatchStyle = "brlist"; |
| 1821 | }else |
| 1822 | if( (z = P("rl"))!=0 ){ |
| 1823 | zBrName = z; |
| 1824 | if( related==0 ) related = 1; |
| 1825 | if( zMatchStyle==0 ) zMatchStyle = "brlist"; |
| 1826 | }else |
| 1827 | if( (z = P("ml"))!=0 ){ |
| 1828 | zBrName = z; |
| 1829 | if( related==0 ) related = 2; |
| 1830 | if( zMatchStyle==0 ) zMatchStyle = "brlist"; |
| 1831 | } |
| 1832 | } |
| 1833 | |
| 1834 | /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */ |
| 1835 | if( zBrName ){ |
| @@ -2919,12 +2925,19 @@ | |
| 2919 | @ ↑</a> |
| 2920 | } |
| 2921 | cgi_check_for_malice(); |
| 2922 | { |
| 2923 | Matcher *pLeftBranch; |
| 2924 | if( P("sl")!=0 ){ |
| 2925 | pLeftBranch = match_create(zMatchStyle?matchStyle:MS_BRLIST, P("sl")); |
| 2926 | }else{ |
| 2927 | pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName); |
| 2928 | } |
| 2929 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 2930 | selectedRid, secondaryRid, 0); |
| 2931 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1813,23 +1813,29 @@ | |
| 1813 | |
| 1814 | /* Check for tl=TAGLIST and rl=TAGLIST which are abbreviations for |
| 1815 | ** t=TAGLIST&ms=brlist and r=TAGLIST&ms=brlist repectively. */ |
| 1816 | if( zBrName==0 && zTagName==0 ){ |
| 1817 | const char *z; |
| 1818 | const char *zPattern = 0; |
| 1819 | if( (z = P("tl"))!=0 ){ |
| 1820 | zPattern = zTagName = z; |
| 1821 | }else if( (z = P("rl"))!=0 ){ |
| 1822 | zPattern = zBrName = z; |
| 1823 | if( related==0 ) related = 1; |
| 1824 | }else if( (z = P("ml"))!=0 ){ |
| 1825 | zPattern = zBrName = z; |
| 1826 | if( related==0 ) related = 2; |
| 1827 | } |
| 1828 | if( zPattern!=0 && zMatchStyle==0 ){ |
| 1829 | /* If there was no ms= query parameter, set the match style to |
| 1830 | ** "glob" if the pattern appears to contain GLOB character, or |
| 1831 | ** "brlist" if it does not. */ |
| 1832 | if( strpbrk(zPattern,"*[?") ){ |
| 1833 | zMatchStyle = "glob"; |
| 1834 | }else{ |
| 1835 | zMatchStyle = "brlist"; |
| 1836 | } |
| 1837 | } |
| 1838 | } |
| 1839 | |
| 1840 | /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */ |
| 1841 | if( zBrName ){ |
| @@ -2919,12 +2925,19 @@ | |
| 2925 | @ ↑</a> |
| 2926 | } |
| 2927 | cgi_check_for_malice(); |
| 2928 | { |
| 2929 | Matcher *pLeftBranch; |
| 2930 | const char *zPattern = P("sl"); |
| 2931 | if( zPattern!=0 ){ |
| 2932 | MatchStyle ms; |
| 2933 | if( zMatchStyle!=0 ){ |
| 2934 | ms = matchStyle; |
| 2935 | }else{ |
| 2936 | ms = strpbrk(zPattern,"*[?")!=0 ? MS_GLOB : MS_BRLIST; |
| 2937 | } |
| 2938 | pLeftBranch = match_create(ms,zPattern); |
| 2939 | }else{ |
| 2940 | pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName); |
| 2941 | } |
| 2942 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 2943 | selectedRid, secondaryRid, 0); |
| 2944 |