Fossil SCM
Fix the /file page so that it shows the text of files that are not identified as special binary types.
Commit
1e008989496a5aac6674c8c7d0f63af1b25357322772a4b6142b7450aa527112
Parent
d0e81e5941c386e…
1 file changed
+4
-2
+4
-2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2502,18 +2502,20 @@ | ||
| 2502 | 2502 | @ ); |
| 2503 | 2503 | @ </script> |
| 2504 | 2504 | }else if( renderAsSvg ){ |
| 2505 | 2505 | @ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object> |
| 2506 | 2506 | }else{ |
| 2507 | + const char *zContentMime; | |
| 2507 | 2508 | style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid); |
| 2508 | 2509 | if( zLn==0 || atoi(zLn)==0 ){ |
| 2509 | 2510 | style_submenu_checkbox("ln", "Line Numbers", 0, 0); |
| 2510 | 2511 | } |
| 2511 | 2512 | blob_to_utf8_no_bom(&content, 0); |
| 2512 | - if( zMime==0 ) zMime = mimetype_from_content(&content); | |
| 2513 | + zContentMime = mimetype_from_content(&content); | |
| 2514 | + if( zMime==0 ) zMime = zContentMime; | |
| 2513 | 2515 | @ <blockquote class="file-content"> |
| 2514 | - if( zMime==0 || strncmp(zMime, "text/", 5)==0 ){ | |
| 2516 | + if( zContentMime==0 ){ | |
| 2515 | 2517 | const char *z, *zFileName, *zExt; |
| 2516 | 2518 | z = blob_str(&content); |
| 2517 | 2519 | zFileName = db_text(0, |
| 2518 | 2520 | "SELECT name FROM mlink, filename" |
| 2519 | 2521 | " WHERE filename.fnid=mlink.fnid" |
| 2520 | 2522 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2502,18 +2502,20 @@ | |
| 2502 | @ ); |
| 2503 | @ </script> |
| 2504 | }else if( renderAsSvg ){ |
| 2505 | @ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object> |
| 2506 | }else{ |
| 2507 | style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid); |
| 2508 | if( zLn==0 || atoi(zLn)==0 ){ |
| 2509 | style_submenu_checkbox("ln", "Line Numbers", 0, 0); |
| 2510 | } |
| 2511 | blob_to_utf8_no_bom(&content, 0); |
| 2512 | if( zMime==0 ) zMime = mimetype_from_content(&content); |
| 2513 | @ <blockquote class="file-content"> |
| 2514 | if( zMime==0 || strncmp(zMime, "text/", 5)==0 ){ |
| 2515 | const char *z, *zFileName, *zExt; |
| 2516 | z = blob_str(&content); |
| 2517 | zFileName = db_text(0, |
| 2518 | "SELECT name FROM mlink, filename" |
| 2519 | " WHERE filename.fnid=mlink.fnid" |
| 2520 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2502,18 +2502,20 @@ | |
| 2502 | @ ); |
| 2503 | @ </script> |
| 2504 | }else if( renderAsSvg ){ |
| 2505 | @ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object> |
| 2506 | }else{ |
| 2507 | const char *zContentMime; |
| 2508 | style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid); |
| 2509 | if( zLn==0 || atoi(zLn)==0 ){ |
| 2510 | style_submenu_checkbox("ln", "Line Numbers", 0, 0); |
| 2511 | } |
| 2512 | blob_to_utf8_no_bom(&content, 0); |
| 2513 | zContentMime = mimetype_from_content(&content); |
| 2514 | if( zMime==0 ) zMime = zContentMime; |
| 2515 | @ <blockquote class="file-content"> |
| 2516 | if( zContentMime==0 ){ |
| 2517 | const char *z, *zFileName, *zExt; |
| 2518 | z = blob_str(&content); |
| 2519 | zFileName = db_text(0, |
| 2520 | "SELECT name FROM mlink, filename" |
| 2521 | " WHERE filename.fnid=mlink.fnid" |
| 2522 |