anchor.diff:  service_available(ReqData, ConfigProps) ->
       Context = z_context:set(ConfigProps, z_context:new(ReqData)),
       Context1 = z_context:ensure_qs(z_context:continue_session(Context)),
  -    {_, ReqData1, ContextFile} = ensure_file_info(ReqData, Context1),
  -    ContextMime = case z_context:get(mime, ContextFile) of
  -        undefined ->
  -            Path = case z_context:get(path, Context) of
  -                undefined -> mochiweb_util:unquote(wrq:disp_path(ReqData1));
  -                ConfiguredPath -> ConfiguredPath
  -            end, 
  -            CT = z_media_identify:guess_mime(Path),
  -            z_context:set(mime, CT, ContextFile);
  -        _Mime -> 
  -            ContextFile
  -    end,
       
  -    case filelib:file_size(z_context:get(fullpath, ContextMime)) of
  -        N when N > ?CHUNKED_CONTENT_LENGTH ->
  -            ContextChunked = z_context:set([{chunked, true}, {file_size, N}], ContextMime), 
  -            ?WM_REPLY(true, ContextChunked);
  -        _ ->
  -            ?WM_REPLY(true, ContextMime)
  +    try ensure_file_info(ReqData, Context1) of
  +        {_, ReqData1, ContextFile} ->
  +            ContextMime = case z_context:get(mime, ContextFile) of
  +                              undefined ->
  +                                  Path = case z_context:get(path, Context) of
  +                                             undefined -> mochiweb_util:unquote(wrq:disp_path(ReqData1));
  +                                             ConfiguredPath -> ConfiguredPath
  +                                         end, 
  +                                  CT = z_media_identify:guess_mime(Path),
  +                                  z_context:set(mime, CT, ContextFile);
  +                              _Mime -> 
  +                                  ContextFile
  +                          end,
  +    
  +            case filelib:file_size(z_context:get(fullpath, ContextMime)) of
  +                N when N > ?CHUNKED_CONTENT_LENGTH ->
  +                    ContextChunked = z_context:set([{chunked, true}, {file_size, N}], ContextMime), 
  +                    ?WM_REPLY(true, ContextChunked);
  +                _ ->
  +                    ?WM_REPLY(true, ContextMime)
  +            end
  +    catch 
  +        _:checksum_invalid ->
  +            %% Not a nice solution, but since 'resource_exists'
  +            %% are checked much later in the wm flow, we would otherwise 
  +            %% have to break the logical flow, and introduce some ugly
  +            %% condition checking in the intermediate callback functions.            
  +            ?WM_REPLY(false, Context1)
       end.
   
   
  
positive.code:             {false, ReqData, Context};
          Safepath  ->
              MediaPath = case z_context:get(media_path, Context) of
                  undefined -> z_path:media_archive(Context);
                  ConfMediaPath -> ConfMediaPath
              end,
              
              MediaFile = case Safepath of 
                      "lib/" ++ LibPath ->  
                          case z_module_indexer:find(lib, LibPath, Context) of 
                              {ok, ModuleFilename} -> ModuleFilename; 
                              {error, _} -> filename:join(MediaPath, Safepath) 
                          end; 
                      _ -> 
                          filename:join(MediaPath, Safepath) 
              end,
              case filelib:is_regular(MediaFile) of
                  true ->
                      % Media file exists, perform the resize
                      Root = case z_context:get(root, Context) of
                          [ConfRoot|_] -> ConfRoot;
                          _ -> z_path:media_preview(Context)
                      end,
                      PreviewFile = filename:join(Root, Path),
                      case z_media_preview:convert(MediaFile, PreviewFile, PreviewPropList, Context) of
                          ok -> {true, ReqData, z_context:set(fullpath, PreviewFile, Context)};
  
negative.code: 
  %% Encode the data so that the identity variant comes first and then the gzip'ed variant
  encode_data(Data) when is_binary(Data) ->
      {Data, zlib:gzip(Data)}.
  
  decode_data(gzip, Data) when is_binary(Data) ->
      zlib:gzip(Data);
  decode_data(identity, Data) when is_binary(Data) ->
      Data;
  decode_data(identity, {Data, _Gzip}) ->
      Data;
  decode_data(gzip, {_Data, Gzip}) ->
      Gzip.
  
      