Skip to content

Commit ca994d3

Browse files
committed
Fix bug with media files, don't encode thumbnail when not necessary
1 parent db22859 commit ca994d3

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/index/elastic.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ void *create_bulk_buffer(int max, int *count, size_t *buf_len) {
110110

111111
size_t buf_size = 0;
112112
size_t buf_cur = 0;
113-
char *buf = malloc(8196);
114-
size_t buf_capacity = 8196;
113+
char *buf = malloc(8192);
114+
size_t buf_capacity = 8192;
115115

116116
while (line != NULL && *count < max) {
117117
char action_str[256];

src/index/web.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ subreq_ctx_t *http_req(const char *url, const char *extra_headers, const char *p
8383
subreq_ctx_t *ctx = malloc(sizeof(subreq_ctx_t));
8484
mg_mgr_init(&ctx->mgr, NULL);
8585

86-
char address[8196];
86+
char address[8192];
8787
snprintf(address, sizeof(address), "tcp://%.*s:%u", (int) host.len, host.p, port);
8888
struct mg_connection *nc = mg_connect(&ctx->mgr, address, http_req_ev);
8989
nc->user_data = &ctx->ev_data;

src/types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ typedef struct index_descriptor {
1010
char version[64];
1111
long timestamp;
1212
char root[PATH_MAX];
13-
char rewrite_url[8196];
13+
char rewrite_url[8192];
1414
short root_len;
1515
char name[1024];
1616
char type[64];

src/web/serve.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void stats_files(struct mg_connection *nc, struct http_message *hm, struct mg_st
111111
return;
112112
}
113113

114-
char disposition[8196];
114+
char disposition[8192];
115115
snprintf(disposition, sizeof(disposition), "Content-Disposition: inline; filename=\"%s\"", file);
116116

117117
char full_path[PATH_MAX];
@@ -256,7 +256,7 @@ int serve_file_from_url(cJSON *json, index_t *idx, struct mg_connection *nc) {
256256

257257
const char *ext = cJSON_GetObjectItem(json, "extension")->valuestring;
258258

259-
char url[8196];
259+
char url[8192];
260260
snprintf(url, sizeof(url),
261261
"%s%s/%s%s%s",
262262
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
291291

292292
LOG_DEBUGF("serve.c", "Serving file from disk: %s", full_path)
293293

294-
char disposition[8196];
294+
char disposition[8192];
295295
snprintf(disposition, sizeof(disposition), "Content-Disposition: inline; filename=\"%s%s%s\"",
296296
name, strlen(ext) == 0 ? "" : ".", ext);
297297

@@ -538,7 +538,7 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path)
538538
}
539539
}
540540

541-
char buf[8196];
541+
char buf[8192];
542542
snprintf(buf, sizeof(buf),
543543
"{"
544544
" \"script\" : {"
@@ -558,7 +558,7 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path)
558558
} else {
559559
cJSON_AddItemToArray(arr, cJSON_CreateString(arg_req->name));
560560

561-
char buf[8196];
561+
char buf[8192];
562562
snprintf(buf, sizeof(buf),
563563
"{"
564564
" \"script\" : {"

third-party/libscan

0 commit comments

Comments
 (0)