dc721b282cc44354ce2521a7185e3d9a1893e93e
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 05865f3..caadb39 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -431,8 +431,21 @@ download_requested_dialog_response_cb (GtkDialog *dialog,
   if (response_id == GTK_RESPONSE_ACCEPT) {
     DownloaderView *dview;
     char *uri;
+    GFile *destination_file;
+
+    uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+
+    /* Check if the file exists and if so, delete it.
+     * When the user selects an existing file in the GtkFileChooserDialog, GTK+
+     * will ask him/her if it's ok to replace the destination file.
+     * We can be sure the user is aware of the consequences of this operation
+     * at this point
+     */
+    destination_file = g_file_new_for_uri (uri);
+    if (g_file_query_exists (destination_file, NULL))
+      g_file_delete (destination_file, NULL, NULL);
+    g_object_unref (destination_file);
 
-    uri = gtk_file_chooser_get_uri  (GTK_FILE_CHOOSER(dialog));
     webkit_download_set_destination_uri (download, uri);
     g_free (uri);
 
