Branch: Tag:

2008-10-29

2008-10-29 10:58:01 by Erik Dahl <erikd@roxen.com>

HTTP encodes just the filename using http_encode_url() not the whole path

Rev: server/modules/graphics/cimg.pike:1.77

7:      roxen.ImageCache the_cache;    - constant cvs_version = "$Id: cimg.pike,v 1.76 2008/10/28 23:23:04 erikd Exp $"; + constant cvs_version = "$Id: cimg.pike,v 1.77 2008/10/29 10:58:01 erikd Exp $";   constant module_type = MODULE_TAG;   constant module_name = "Graphics: Image converter";   constant module_doc = "Provides the tag <tt>&lt;cimg&gt;</tt> that can be used "
391:   #endif    res->src=(query_absolute_internal_location(id)+the_cache->store( a,id ));    if(args->filename && sizeof(args->filename)) -  res->src += "/" + args->filename; +  res->src += "/" + Roxen.http_encode_url(args->filename);    if(do_ext)    res->src += "." + (a->format || "gif"); -  res->src = Roxen.http_encode_invalids(res->src); +     data = the_cache->data( a, id , 0 );    res["file-size"] = strlen(data);    res["file-size-kb"] = strlen(data)/1024;
434:    string ext = "";    string filename = "";    if(args->filename && sizeof(args->filename)) -  filename += "/" + m_delete(args, "filename"); +  filename += "/" + Roxen.http_encode_url(m_delete(args, "filename"));    if(do_ext)    ext = "." + (a->format || "gif"); -  args->src = Roxen.http_encode_invalids( query_absolute_internal_location( id ) -  + the_cache->store( a, id ) + filename + ext -  ); +  args->src = query_absolute_internal_location( id ) +  + the_cache->store( a, id ) + filename + ext;    int no_draw = !id->misc->generate_images;    if( mapping size = the_cache->metadata( a, id, no_draw ) )    {
468:    {    string filename = "";    if(args->filename && sizeof(args->filename)) -  filename = "/" + m_delete(args, "filename"); -  result = Roxen.http_encode_invalids( query_absolute_internal_location(id) +  filename = "/" + Roxen.http_encode_url(m_delete(args, "filename")); +  result = query_absolute_internal_location(id)    + the_cache->store(get_my_args(check_args( args ), id ), id)    + filename -  + (do_ext ? "." + (args->format || "gif") : "") -  ); +  + (do_ext ? "." + (args->format || "gif") : "");    return 0;    }    }   }