mirror of
https://github.com/rkd77/elinks.git
synced 2024-10-29 08:17:18 -04:00
Fix problem with double decompression of local files
ELinks tries decompress local gziped files twice, which causes problems with some files eg. with this README.gz. This patch prevents it.
This commit is contained in:
parent
3dadc0ad46
commit
d09bdf7c28
@ -205,7 +205,6 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
|||||||
{
|
{
|
||||||
struct uri *uri = cached->uri;
|
struct uri *uri = cached->uri;
|
||||||
enum stream_encoding encoding = ENCODING_NONE;
|
enum stream_encoding encoding = ENCODING_NONE;
|
||||||
unsigned char *extension;
|
|
||||||
struct fragment *fragment = get_cache_fragment(cached);
|
struct fragment *fragment = get_cache_fragment(cached);
|
||||||
struct string buffer = INIT_STRING("", 0);
|
struct string buffer = INIT_STRING("", 0);
|
||||||
|
|
||||||
@ -216,23 +215,26 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
|||||||
buffer.length = fragment->length;
|
buffer.length = fragment->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
extension = get_extension_from_uri(uri);
|
if (uri->protocol != PROTOCOL_FILE) {
|
||||||
if (extension) {
|
unsigned char *extension = get_extension_from_uri(uri);
|
||||||
encoding = guess_encoding(extension);
|
|
||||||
mem_free(extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (encoding != ENCODING_NONE) {
|
if (extension) {
|
||||||
int length = 0;
|
encoding = guess_encoding(extension);
|
||||||
unsigned char *source;
|
mem_free(extension);
|
||||||
|
}
|
||||||
|
|
||||||
source = decode_encoded_buffer(encoding, buffer.source,
|
if (encoding != ENCODING_NONE) {
|
||||||
|
int length = 0;
|
||||||
|
unsigned char *source;
|
||||||
|
|
||||||
|
source = decode_encoded_buffer(encoding, buffer.source,
|
||||||
buffer.length, &length);
|
buffer.length, &length);
|
||||||
if (source) {
|
if (source) {
|
||||||
buffer.source = source;
|
buffer.source = source;
|
||||||
buffer.length = length;
|
buffer.length = length;
|
||||||
} else {
|
} else {
|
||||||
encoding = ENCODING_NONE;
|
encoding = ENCODING_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user