Source: filetea
Version: 0.1.18-3
Severity: serious
Tags: forky sid patch
User: [email protected]
Usertags: libsoup2
Control: block 1056125 by -1

This package uses libsoup functions and links with libsoup but as it
doesn't explicitly build-depend on it, this bug was missed during the
libsoup2.4-removal MBF.

I've only build-tested the attached patch.  Since filetea is a libevd
reverse dependency, it must be uploaded after #1073943 is fixed and
with the appropriate versioned Build-Depends on libevd-0.2-dev.
Description: Port to libsoup3.
Bug-Debian: ?
Author: Yavor Doganov <[email protected]>
Forwarded: no
Last-Update: 2025-10-16
---

--- filetea.orig/filetea/filetea-node.c
+++ filetea/filetea/filetea-node.c
@@ -21,6 +21,7 @@
  */
 
 #include <uuid/uuid.h>
+#include <libsoup/soup-uri-utils.h>
 
 #include "filetea-node.h"
 #include "file-source.h"
@@ -793,7 +794,7 @@
 handle_special_request (FileteaNode         *self,
                         EvdHttpConnection   *conn,
                         EvdHttpRequest      *request,
-                        SoupURI             *uri,
+                        GUri                *uri,
                         gchar             **tokens)
 {
   const gchar *id;
@@ -885,17 +886,19 @@
             {
               gboolean download;
               FileTransfer *transfer;
+              const gchar *query;
 
               download = g_strcmp0 (action, PATH_ACTION_VIEW) != 0;
 
               transfer = setup_new_transfer (self, source, conn, download);
+              query = g_uri_get_query (uri);
 
-              if (uri->query != NULL)
+              if (query != NULL)
                 {
                   EvdPeer *peer;
 
                   peer = evd_transport_lookup_peer (EVD_TRANSPORT 
(self->priv->transport),
-                                                    uri->query);
+                                                    query);
                   if (peer != NULL)
                     file_transfer_set_target_peer (transfer, peer);
                 }
@@ -916,7 +919,7 @@
   FileteaNode *self = FILETEA_NODE (web_service);
 
   gchar **tokens;
-  SoupURI *uri;
+  GUri *uri;
   guint tokens_len;
 
   uri = evd_http_request_get_uri (request);
@@ -925,12 +928,15 @@
   if (self->priv->force_https &&
       ! evd_connection_get_tls_active (EVD_CONNECTION (conn)))
     {
+      GUri *guri;
       gchar *new_uri;
 
-      soup_uri_set_scheme (uri, "https");
-      soup_uri_set_port (uri, self->priv->https_port);
+      guri = soup_uri_copy (uri, SOUP_URI_SCHEME, "https",
+                            SOUP_URI_PORT, self->priv->https_port,
+                            SOUP_URI_NONE);
 
-      new_uri = soup_uri_to_string (uri, FALSE);
+      new_uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
+      g_uri_unref (guri);
 
       evd_http_connection_redirect (conn, new_uri, FALSE, NULL);
 
@@ -939,7 +945,7 @@
       return;
     }
 
-  tokens = g_strsplit (uri->path, "/", 16);
+  tokens = g_strsplit (g_uri_get_path (uri), "/", 16);
   tokens_len = g_strv_length (tokens);
 
   if (tokens_len >= 2 &&
--- filetea.orig/filetea/file-transfer.c
+++ filetea/filetea/file-transfer.c
@@ -185,7 +185,7 @@
       gchar *st;
       gchar *decoded_file_name;
 
-      decoded_file_name = soup_uri_decode (self->source->file_name);
+      decoded_file_name = g_uri_unescape_string (self->source->file_name, 
NULL);
       st = g_strdup_printf ("attachment; filename=\"%s\"", decoded_file_name);
       g_free (decoded_file_name);
       soup_message_headers_replace (headers, "Content-disposition", st);
@@ -220,7 +220,7 @@
       file_transfer_read (self);
     }
 
-  soup_message_headers_free (headers);
+  soup_message_headers_unref (headers);
 }
 
 static void

Reply via email to