Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian....@packages.debian.org
Usertags: pu

Hi,

megatools can be used (among other things) to download files from the
Mega cloud storage service.

Files can be downloaded using a link that contains a file handle and
an encryption key.

The format of these links has changed recently and megatools 1.10.2
doesn't recognize them.

This upload includes a simple patch (already committed upstream) to
add support for these new links.

Debdiff attached.

Berto

-- System Information:
Debian Release: 10.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), 
LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru megatools-1.10.2/debian/changelog megatools-1.10.2/debian/changelog
--- megatools-1.10.2/debian/changelog   2018-08-01 09:42:42.000000000 +0200
+++ megatools-1.10.2/debian/changelog   2020-04-15 13:43:30.000000000 +0200
@@ -1,3 +1,10 @@
+megatools (1.10.2-1+deb10u1) unstable; urgency=medium
+
+  * debian/patches/support-new-links.patch:
+    - Add support for the new format of mega.nz links.
+
+ -- Alberto Garcia <be...@igalia.com>  Wed, 15 Apr 2020 13:43:30 +0200
+
 megatools (1.10.2-1) unstable; urgency=medium
 
   * New upstream release (Closes: #905156).
diff -Nru megatools-1.10.2/debian/patches/series 
megatools-1.10.2/debian/patches/series
--- megatools-1.10.2/debian/patches/series      2018-08-01 09:42:42.000000000 
+0200
+++ megatools-1.10.2/debian/patches/series      2020-04-15 13:43:30.000000000 
+0200
@@ -1 +1,2 @@
 make-verbose.patch
+support-new-links.patch
diff -Nru megatools-1.10.2/debian/patches/support-new-links.patch 
megatools-1.10.2/debian/patches/support-new-links.patch
--- megatools-1.10.2/debian/patches/support-new-links.patch     1970-01-01 
01:00:00.000000000 +0100
+++ megatools-1.10.2/debian/patches/support-new-links.patch     2020-04-15 
13:43:30.000000000 +0200
@@ -0,0 +1,56 @@
+From: Alberto Garcia <be...@igalia.com>
+Subject: Support new format of mega.nz links
+Origin: 
https://megous.com/git/megatools/commit/?id=5d04a6203a231e8a3ea19bd1f203faee88e4b3a9
+Index: megatools/tools/dl.c
+===================================================================
+--- megatools.orig/tools/dl.c
++++ megatools/tools/dl.c
+@@ -320,6 +320,7 @@ int main(int ac, char *av[])
+ {
+       gc_error_free GError *local_err = NULL;
+       gc_regex_unref GRegex *file_regex = NULL, *folder_regex = NULL;
++      gc_regex_unref GRegex *file_regex2 = NULL, *folder_regex2 = NULL;;
+       gint i;
+       int status = 0;
+ 
+@@ -353,11 +354,20 @@ int main(int ac, char *av[])
+                                0, NULL);
+       g_assert(file_regex != NULL);
+ 
++      file_regex2 = 
g_regex_new("^https?://mega\\.nz/file/([a-z0-9_-]{8})#([a-z0-9_-]{43})$", 
G_REGEX_CASELESS,
++                                  0, NULL);
++      g_assert(file_regex2 != NULL);
++
+       folder_regex =
+               
g_regex_new("^https?://mega(?:\\.co)?\\.nz/#F!([a-z0-9_-]{8})!([a-z0-9_-]{22})(![a-z0-9_-]{8})?$",
+                           G_REGEX_CASELESS, 0, NULL);
+       g_assert(folder_regex != NULL);
+ 
++      folder_regex2 =
++              
g_regex_new("^https?://mega\\.nz/folder/([a-z0-9_-]{8})#([a-z0-9_-]{22})$",
++                          G_REGEX_CASELESS, 0, NULL);
++      g_assert(folder_regex2 != NULL);
++
+       // create session
+ 
+       s = tool_start_session(TOOL_SESSION_OPEN | TOOL_SESSION_AUTH_ONLY | 
TOOL_SESSION_AUTH_OPTIONAL);
+@@ -377,7 +387,8 @@ int main(int ac, char *av[])
+               gc_free gchar *specific = NULL;
+               gc_free gchar *link = tool_convert_filename(av[i], FALSE);
+ 
+-              if (g_regex_match(file_regex, link, 0, &m1)) {
++              if (g_regex_match(file_regex, link, 0, &m1) ||
++                    g_regex_match(file_regex2, link, 0, &m1)) {
+                       handle = g_match_info_fetch(m1, 1);
+                       key = g_match_info_fetch(m1, 2);
+ 
+@@ -398,7 +409,8 @@ int main(int ac, char *av[])
+                               if (opt_print_names)
+                                       g_print("%s\n", cur_file);
+                       }
+-              } else if (g_regex_match(folder_regex, link, 0, &m2)) {
++              } else if (g_regex_match(folder_regex, link, 0, &m2) ||
++                           g_regex_match(folder_regex2, link, 0, &m2)) {
+                       if (opt_stream) {
+                               g_printerr("ERROR: Can't stream from a 
directory!\n");
+                               tool_fini(s);

Reply via email to