mirror of
https://github.com/simon987/sist2.git
synced 2025-04-18 17:56:44 +00:00
Fix bug with media files, don't encode thumbnail when not necessary
This commit is contained in:
parent
db2285973f
commit
ca994d3914
@ -110,8 +110,8 @@ void *create_bulk_buffer(int max, int *count, size_t *buf_len) {
|
|||||||
|
|
||||||
size_t buf_size = 0;
|
size_t buf_size = 0;
|
||||||
size_t buf_cur = 0;
|
size_t buf_cur = 0;
|
||||||
char *buf = malloc(8196);
|
char *buf = malloc(8192);
|
||||||
size_t buf_capacity = 8196;
|
size_t buf_capacity = 8192;
|
||||||
|
|
||||||
while (line != NULL && *count < max) {
|
while (line != NULL && *count < max) {
|
||||||
char action_str[256];
|
char action_str[256];
|
||||||
|
@ -83,7 +83,7 @@ subreq_ctx_t *http_req(const char *url, const char *extra_headers, const char *p
|
|||||||
subreq_ctx_t *ctx = malloc(sizeof(subreq_ctx_t));
|
subreq_ctx_t *ctx = malloc(sizeof(subreq_ctx_t));
|
||||||
mg_mgr_init(&ctx->mgr, NULL);
|
mg_mgr_init(&ctx->mgr, NULL);
|
||||||
|
|
||||||
char address[8196];
|
char address[8192];
|
||||||
snprintf(address, sizeof(address), "tcp://%.*s:%u", (int) host.len, host.p, port);
|
snprintf(address, sizeof(address), "tcp://%.*s:%u", (int) host.len, host.p, port);
|
||||||
struct mg_connection *nc = mg_connect(&ctx->mgr, address, http_req_ev);
|
struct mg_connection *nc = mg_connect(&ctx->mgr, address, http_req_ev);
|
||||||
nc->user_data = &ctx->ev_data;
|
nc->user_data = &ctx->ev_data;
|
||||||
|
@ -10,7 +10,7 @@ typedef struct index_descriptor {
|
|||||||
char version[64];
|
char version[64];
|
||||||
long timestamp;
|
long timestamp;
|
||||||
char root[PATH_MAX];
|
char root[PATH_MAX];
|
||||||
char rewrite_url[8196];
|
char rewrite_url[8192];
|
||||||
short root_len;
|
short root_len;
|
||||||
char name[1024];
|
char name[1024];
|
||||||
char type[64];
|
char type[64];
|
||||||
|
@ -111,7 +111,7 @@ void stats_files(struct mg_connection *nc, struct http_message *hm, struct mg_st
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char disposition[8196];
|
char disposition[8192];
|
||||||
snprintf(disposition, sizeof(disposition), "Content-Disposition: inline; filename=\"%s\"", file);
|
snprintf(disposition, sizeof(disposition), "Content-Disposition: inline; filename=\"%s\"", file);
|
||||||
|
|
||||||
char full_path[PATH_MAX];
|
char full_path[PATH_MAX];
|
||||||
@ -256,7 +256,7 @@ int serve_file_from_url(cJSON *json, index_t *idx, struct mg_connection *nc) {
|
|||||||
|
|
||||||
const char *ext = cJSON_GetObjectItem(json, "extension")->valuestring;
|
const char *ext = cJSON_GetObjectItem(json, "extension")->valuestring;
|
||||||
|
|
||||||
char url[8196];
|
char url[8192];
|
||||||
snprintf(url, sizeof(url),
|
snprintf(url, sizeof(url),
|
||||||
"%s%s/%s%s%s",
|
"%s%s/%s%s%s",
|
||||||
idx->desc.rewrite_url, path_unescaped, name_unescaped, strlen(ext) == 0 ? "" : ".", ext);
|
idx->desc.rewrite_url, path_unescaped, name_unescaped, strlen(ext) == 0 ? "" : ".", ext);
|
||||||
@ -291,7 +291,7 @@ void serve_file_from_disk(cJSON *json, index_t *idx, struct mg_connection *nc, s
|
|||||||
|
|
||||||
LOG_DEBUGF("serve.c", "Serving file from disk: %s", full_path)
|
LOG_DEBUGF("serve.c", "Serving file from disk: %s", full_path)
|
||||||
|
|
||||||
char disposition[8196];
|
char disposition[8192];
|
||||||
snprintf(disposition, sizeof(disposition), "Content-Disposition: inline; filename=\"%s%s%s\"",
|
snprintf(disposition, sizeof(disposition), "Content-Disposition: inline; filename=\"%s%s%s\"",
|
||||||
name, strlen(ext) == 0 ? "" : ".", ext);
|
name, strlen(ext) == 0 ? "" : ".", ext);
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[8196];
|
char buf[8192];
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"{"
|
"{"
|
||||||
" \"script\" : {"
|
" \"script\" : {"
|
||||||
@ -558,7 +558,7 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path)
|
|||||||
} else {
|
} else {
|
||||||
cJSON_AddItemToArray(arr, cJSON_CreateString(arg_req->name));
|
cJSON_AddItemToArray(arr, cJSON_CreateString(arg_req->name));
|
||||||
|
|
||||||
char buf[8196];
|
char buf[8192];
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"{"
|
"{"
|
||||||
" \"script\" : {"
|
" \"script\" : {"
|
||||||
|
2
third-party/libscan
vendored
2
third-party/libscan
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 73c58f1b8d208b0e9ccd57763aaa83460c1fcd78
|
Subproject commit 38d6c2c2440c5df9b803bc3e544e41ffc6c45764
|
Loading…
x
Reference in New Issue
Block a user