diff --git a/src/lander/lander_get.c b/src/lander/lander_get.c index 5bb9f43..40a70d8 100644 --- a/src/lander/lander_get.c +++ b/src/lander/lander_get.c @@ -175,14 +175,19 @@ lnm_http_step_err lander_get_index(lnm_http_conn *conn) { lsm_str_len(entry_key) - prefix_len); break; case lander_entry_type_file: - ltm_instance_block_add_nested(&nested, c_ctx->instance, "file"); + case lander_entry_type_paste: + ltm_instance_block_add_nested(&nested, c_ctx->instance, + t == lander_entry_type_file ? "file" + : "paste"); ltm_instance_block_add_var( nested, "full_key", ltm_instance_block_type_buf, (void *)lsm_str_ptr(entry_key), lsm_str_len(entry_key)); + // Add the filename as the link name if known, or just the key otherwise lsm_str *filename; - if (lsm_entry_attr_get(&filename, handle, lander_attr_type_file_name)) { + if (lsm_entry_attr_get(&filename, handle, lander_attr_type_file_name) == + lsm_error_ok) { ltm_instance_block_add_var( nested, "filename", ltm_instance_block_type_buf, (void *)lsm_str_ptr(filename), lsm_str_len(filename)); diff --git a/src/main.c b/src/main.c index 7554b5b..e55e9df 100644 --- a/src/main.c +++ b/src/main.c @@ -24,7 +24,7 @@ const char *index_template = "\n" "\n" "

Index /{{ title_key }}

\n" - "

Redirects

" + "

Redirects

\n" "\n" + "

Pastes

\n" + "\n" "\n"; lnm_http_loop *loop_init(lander_gctx *gctx, const char *api_key) {