[Github-comments] [geany/geany-plugins] Markdown: Fix relative paths (#501)

Colomban Wendling notifications at xxxxx
Fri Nov 11 21:15:14 UTC 2016


b4n commented on this pull request.



> +      g_free(base_dir);
+    }
+    /* Otherwise assume use a file `index.html` in the current working directory. */
+    else {
+      gchar *cwd = g_get_current_dir();
+      base_path = g_build_filename(cwd, "index.html", NULL);
+      g_free(cwd);
+      g_debug("current document is not saved, using '%s' as base filename", base_path);
+    }
+
+    base_uri = g_filename_to_uri(base_path, NULL, &error);
+    if (base_uri == NULL) {
+      g_warning("failed to encode path '%s' as URI: %s", base_path, error->message);
+      g_error_free(error);
+      base_uri = g_strdup("file://./index.html");
+      g_debug("using phony base URI '%s', broken relative paths are likely", base_uri);

If you never expect this to actually happen and this test is mostly defensive, maybe don't worry too much about it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/501
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20161111/3c014c73/attachment.html>


More information about the Github-comments mailing list