Skip to content

Commit

Permalink
Use download-link op and statistic view
Browse files Browse the repository at this point in the history
  • Loading branch information
杨赫然 committed Dec 5, 2024
1 parent 43f940a commit 4592ce5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions fileserver/fileop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3801,8 +3801,8 @@ func accessLinkCB(rsp http.ResponseWriter, r *http.Request) *appError {
fileName := filepath.Base(filePath)

op := r.URL.Query().Get("op")
if op == "" {
op = "download"
if op != "view" {
op = "download-link"
}

ranges := r.Header["Range"]
Expand Down
16 changes: 7 additions & 9 deletions server/access-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,12 @@ write_data_cb (struct bufferevent *bev, void *ctx)

evhtp_send_reply_end (data->req);

if (g_strcmp0(data->token_type, "view") != 0) {
char *oper = "web-file-download";
if (g_strcmp0(data->token_type, "download-link") == 0)
oper = "link-file-download";
char *oper = "web-file-download";
if (g_strcmp0(data->token_type, "download-link") == 0)
oper = "link-file-download";

send_statistic_msg(data->store_id, data->user, oper,
(guint64)data->file->file_size);
}
send_statistic_msg(data->store_id, data->user, oper,
(guint64)data->file->file_size);

free_sendfile_data (data);
return;
Expand Down Expand Up @@ -1835,8 +1833,8 @@ access_link_cb(evhtp_request_t *req, void *arg)
token = parts[1];

operation = evhtp_kv_find (req->uri->query, "op");
if (!operation) {
operation = "download";
if (g_strcmp0 (operation, "view") != 0) {
operation = "download-link";
}

char *ip_addr = get_client_ip_addr (req);
Expand Down

0 comments on commit 4592ce5

Please sign in to comment.