[gnome-boxes] wizard: Allow a custom filename when sanity-checking downloadable URIs
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] wizard: Allow a custom filename when sanity-checking downloadable URIs
- Date: Thu, 12 Oct 2017 15:26:37 +0000 (UTC)
commit 8fc6a4a5c6d31ac1eb3f4be2e75f644d911f63ae
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Aug 31 20:33:18 2017 +0200
wizard: Allow a custom filename when sanity-checking downloadable URIs
https://bugzilla.gnome.org/show_bug.cgi?id=786679
src/wizard.vala | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index 40ce8a9..dccaca6 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -305,14 +305,20 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
prepare_for_uri (file.get_uri ());
}
- private void prepare_for_uri (string uri_as_text) throws Boxes.Error {
+ private void prepare_for_uri (string uri_as_text, string? filename = null) throws Boxes.Error {
var uri = Xml.URI.parse (uri_as_text);
if (uri == null || uri.scheme == null)
throw new Boxes.Error.INVALID (_("Invalid URL"));
if (wizard_source.download_required) {
- var file = File.new_for_uri (uri_as_text);
- var basename = file.get_basename ();
+ string? basename = null;
+
+ if (filename == null) {
+ var file = File.new_for_uri (uri_as_text);
+ basename = file.get_basename ();
+ } else {
+ basename = filename;
+ }
if (basename == null || basename == "" || basename == "/")
throw new Boxes.Error.INVALID (_("Invalid URL"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]