[gnome-software] trivial: Return a rewrite error if the local file is not found
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Return a rewrite error if the local file is not found
- Date: Thu, 11 May 2017 14:24:55 +0000 (UTC)
commit 16e1e14e2587f4a4aa1bbac3b5cab23bb42b8d7c
Author: Richard Hughes <richard hughsie com>
Date: Thu May 11 15:19:05 2017 +0100
trivial: Return a rewrite error if the local file is not found
lib/gs-plugin.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index f8f6f12..0f636a1 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1340,10 +1340,18 @@ gs_plugin_download_rewrite_resource_uri (GsPlugin *plugin,
g_autofree gchar *cachefn = NULL;
/* local files */
- if (g_str_has_prefix (uri, "/"))
- return g_strdup (uri);
if (g_str_has_prefix (uri, "file://"))
- return g_strdup (uri + 7);
+ uri += 7;
+ if (g_str_has_prefix (uri, "/")) {
+ if (!g_file_test (uri, G_FILE_TEST_EXISTS)) {
+ g_set_error (error,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NOT_SUPPORTED,
+ "Failed to find file: %s", uri);
+ return NULL;
+ }
+ return g_strdup (uri);
+ }
/* get cache location */
cachefn = gs_utils_get_cache_filename ("cssresource", uri,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]