escape gph in paths - stagit-gopher - A git gopher frontend. (mirror) HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit c37c488c222ae62fa82edecd2391e5dd76de1e23 DIR parent f8a73285fa1ba57d5815a9c365db13772896ad19 HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 17 Mar 2019 15:19:54 +0100 escape gph in paths - escape paths in diff line. - escape path in directory selector in files.gph Diffstat: M stagit-gopher.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- DIR diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -636,9 +636,13 @@ printshowfile(FILE *fp, struct commitinfo *ci) patch = ci->deltas[i]->patch; delta = git_patch_get_delta(patch); /* NOTE: only links to new path */ - fprintf(fp, "[1|diff --git a/%s b/%s", - delta->old_file.path, delta->new_file.path); - fprintf(fp, "|%s/file/%s.gph|server|port]\n", relpath, delta->new_file.path); + fputs("[1|diff --git a/", fp); + gphlink(fp, delta->old_file.path, strlen(delta->old_file.path)); + fputs(" b/", fp); + gphlink(fp, delta->new_file.path, strlen(delta->new_file.path)); + fprintf(fp, "|%s/file/", relpath); + gphlink(fp, delta->new_file.path, strlen(delta->new_file.path)); + fputs(".gph|server|port]\n", fp); /* check binary data */ if (delta->flags & GIT_DIFF_FLAG_BINARY) { @@ -968,7 +972,8 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) fprintf(fp, "%7dL", lc); else fprintf(fp, "%7juB", (uintmax_t)filesize); - fprintf(fp, "|%s/%s", relpath, filepath); + fprintf(fp, "|%s/", relpath); + gphlink(fp, filepath, strlen(filepath)); fputs("|server|port]\n", fp); git_object_free(obj); } else if (!git_submodule_lookup(&module, repo, entryname)) {