about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDaniel Santos <dan.git@brilhante.top>2023-05-10 18:51:34 +0100
committerDaniel Santos <dan.git@brilhante.top>2023-07-01 10:08:20 +0100
commit439406a0def941b18850685174dde5daaca7dbf0 (patch)
tree878c561d6b9cd75a04825ad8dedf808b93dc553a
parent35351387a197e55f5389545efe3941b58ca94ffd (diff)
downloadprofani-tty-439406a0def941b18850685174dde5daaca7dbf0.tar.gz
same filename in url open
Signed-off-by: Daniel Santos <dan.git@brilhante.top>
-rw-r--r--src/command/cmd_funcs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index f5535ad9..c50327be 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -9587,6 +9587,23 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
 #ifdef HAVE_OMEMO
     // OMEMO URLs (aesgcm://) must be saved and decrypted before being opened.
     if (g_strcmp0(scheme, "aesgcm") == 0) {
+
+        // Ensure that the downloads directory exists for saving cleartexts.
+        gchar* downloads_dir = files_get_data_path(DIR_DOWNLOADS);
+        if (g_mkdir_with_parents(downloads_dir, S_IRWXU) != 0) {
+            cons_show_error("Failed to create download directory "
+                            "at '%s' with error '%s'",
+                            downloads_dir, strerror(errno));
+            g_free(downloads_dir);
+            goto out;
+        }
+
+        // Generate an unique filename from the URL that should be stored in the
+        // downloads directory.
+        //filename = unique_filename_from_url(url, downloads_dir);
+        filename = g_strdup_printf("%s/%s", downloads_dir, g_strsplit(g_basename(url), "#", 2)[0]);
+        g_free(downloads_dir);
+
         // Download, decrypt and open the cleartext version of the AESGCM
         // encrypted file.
         _url_aesgcm_method(window, cmd_template, url, NULL);
an class='oid'>69d95127 ^
82ac0b7e ^


bc643692 ^
a91c1c2a ^
bc643692 ^

5497090a ^
82ac0b7e ^

a91c1c2a ^
82ac0b7e ^



2199940a ^
82ac0b7e ^
363be37f ^
82ac0b7e ^




363be37f ^
ac0e9db5 ^
05d17773 ^
82ac0b7e ^
ac0e9db5 ^
ab6ed192 ^
0487a30e ^
ac0e9db5 ^
363be37f ^


35064671 ^
82ac0b7e ^

0487a30e ^
35064671 ^



e4630643 ^
0487a30e ^
82ac0b7e ^
363be37f ^
35064671 ^
82ac0b7e ^

35064671 ^
363be37f ^
82ac0b7e ^



82ac0b7e ^


363be37f ^

82ac0b7e ^


35064671 ^
82ac0b7e ^


35064671 ^
0f125d5f ^
82ac0b7e ^
363be37f ^


82ac0b7e ^




363be37f ^
82ac0b7e ^

35064671 ^
ac0e9db5 ^
35064671 ^
82ac0b7e ^
35064671 ^
82ac0b7e ^








363be37f ^
82ac0b7e ^

35064671 ^
82ac0b7e ^






ac0e9db5 ^

82ac0b7e ^

e4630643 ^



0487a30e ^
82ac0b7e ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136