Fossil

Check-in [af16836c]
Login

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

Overview
Comment:Have the "raw" webpage try to guess the filename and the mimetype of the artifact being downloaded, if the m= query parameter is omitted.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: af16836c23b4af75986448f16fe3eb4990a89ecc
User & Date: drh 2012-08-13 16:18:08
Context
2012-08-14
17:30
Merge in the WYSIWYG editor branch, making WYSIWYG an option for trunk users. WYSIWYG is still off by default. check-in: 65870e87 user: drh tags: trunk
2012-08-13
16:18
Have the "raw" webpage try to guess the filename and the mimetype of the artifact being downloaded, if the m= query parameter is omitted. check-in: af16836c user: drh tags: trunk
12:39
Adjust the $current_page for the doc webpage so that it includes the embedded document being rendered. check-in: 22e20511 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/info.c.

1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213








1214
1215
1216
1217
1218
1219
1220
*/
void rawartifact_page(void){
  int rid;
  const char *zMime;
  Blob content;

  rid = name_to_rid_www("name");
  zMime = PD("m","application/x-fossil-artifact");
  login_check_credentials();
  if( !g.perm.Read ){ login_needed(); return; }
  if( rid==0 ) fossil_redirect_home();








  content_get(rid, &content);
  cgi_set_content_type(zMime);
  cgi_set_content(&content);
}

/*
** Render a hex dump of a file.







<



>
>
>
>
>
>
>
>







1203
1204
1205
1206
1207
1208
1209

1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
*/
void rawartifact_page(void){
  int rid;
  const char *zMime;
  Blob content;

  rid = name_to_rid_www("name");

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(); return; }
  if( rid==0 ) fossil_redirect_home();
  zMime = P("m");
  if( zMime==0 ){
    char *zFName = db_text(0, "SELECT filename.name FROM mlink, filename"
                              " WHERE mlink.fid=%d"
                              "   AND filename.fnid=mlink.fnid", rid);
    if( zFName ) zMime = mimetype_from_name(zFName);
    if( zMime==0 ) zMime = "application/x-fossil-artifact";
  }
  content_get(rid, &content);
  cgi_set_content_type(zMime);
  cgi_set_content(&content);
}

/*
** Render a hex dump of a file.