aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-01 00:09:40 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-01 00:09:40 +0800
commit9b8959a4de1dc5eacdf807ae6d311defce4fad51 (patch)
tree88ac3f23c1b1024b3b6d7101bbc6712ebd943e74 /src
parentddf12994065314b103f57969640845d7344974f2 (diff)
downloadgsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.tar
gsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.tar.gz
gsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.tar.bz2
gsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.tar.lz
gsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.tar.xz
gsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.tar.zst
gsoc2013-epiphany-9b8959a4de1dc5eacdf807ae6d311defce4fad51.zip
Move mime permission checks to ephy-file-helpers.
2004-12-31 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-shell.c: (ephy_embed_shell_finalize), (ephy_embed_shell_get_encodings): * embed/ephy-embed-shell.h: * embed/mozilla/ContentHandler.cpp: * embed/mozilla/ContentHandler.h: * lib/ephy-file-helpers.c: (ephy_file_helpers_shutdown), (ephy_file_delete_on_exit), (load_mime_from_xml), (ephy_file_check_mime): * lib/ephy-file-helpers.h: Move mime permission checks to ephy-file-helpers. * src/popup-commands.c: (image_open_uri), (save_source_completed_cb), (popup_cmd_open_image): Only open the image if its mime type is 'safe'.
Diffstat (limited to 'src')
-rw-r--r--src/popup-commands.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/popup-commands.c b/src/popup-commands.c
index fd7805034..4804b3316 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -365,7 +365,8 @@ popup_cmd_open_frame (GtkAction *action,
}
static void
-image_open_uri (const char *address)
+image_open_uri (const char *address,
+ gboolean delete)
{
GList *uris = NULL;
char *canonical;
@@ -380,7 +381,8 @@ image_open_uri (const char *address)
GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE) == GNOME_VFS_OK &&
(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) &&
info->mime_type != NULL &&
- info->mime_type[0] != '\0')
+ info->mime_type[0] != '\0' &&
+ ephy_file_check_mime (info->mime_type) == EPHY_MIME_PERMISSION_SAFE)
{
app = gnome_vfs_mime_get_default_application (info->mime_type);
}
@@ -392,12 +394,20 @@ image_open_uri (const char *address)
gnome_vfs_mime_application_launch (app, uris);
gnome_vfs_mime_application_free (app);
g_list_free (uris);
+ if (delete)
+ {
+ ephy_file_delete_on_exit (address);
+ }
}
else
{
/* FIXME We should really warn the user here */
g_warning ("Cannot find an application to open %s with.", address);
+ if (delete)
+ {
+ gnome_vfs_unlink (address);
+ }
}
g_free (canonical);
@@ -412,9 +422,7 @@ save_source_completed_cb (EphyEmbedPersist *persist)
dest = ephy_embed_persist_get_dest (persist);
g_return_if_fail (dest != NULL);
- ephy_file_delete_on_exit (dest);
-
- image_open_uri (dest);
+ image_open_uri (dest, TRUE);
}
static void
@@ -475,7 +483,7 @@ popup_cmd_open_image (GtkAction *action,
if (strcmp (scheme, "file") == 0)
{
- image_open_uri (address);
+ image_open_uri (address, FALSE);
}
else
{