* update deluge to 1:2.1.1-8

This commit is contained in:
Alexander Baldeck 2025-01-08 08:47:02 +01:00
parent 8eb6e9f68b
commit 8ce19fed73
3 changed files with 127 additions and 4 deletions

View File

@ -1,7 +1,7 @@
pkgbase = deluge
pkgdesc = BitTorrent client with multiple user interfaces in a client/server model
pkgver = 2.1.1
pkgrel = 7
pkgrel = 8
epoch = 1
url = https://deluge-torrent.org/
arch = any
@ -46,10 +46,12 @@ pkgbase = deluge
source = git+https://git.deluge-torrent.org/deluge?signed#tag=deluge-2.1.1
source = 0001-Update-metainfo-install-path.patch
source = 0002-Fix-data-installation-when-building-wheel.patch
source = 0003-UI-Replace-deprecated-cgi-module-with-email.patch
validpgpkeys = EA01185D0E8AA00D6323A30890597A687B836BA3
b2sums = 950bf89a60f23e2b1d65413afcb8f71ae159092051477546c56936c092f6c3d8a345f54081d92ae3866a2194f6f2a09553bde71ba4d70b749b9abc234bdd9db5
b2sums = 864c8ca71e718e3d8cdd6021f5e3ddf82782955da6d25f9f3077a8dd59d2a8a798460c0f26fcf95b3b17d595b69c2f10b92a564c4482e3ac0ca27304dba9bd39
b2sums = c503eface42fc12cb04086a5a77a862ee44f78ecdd6ad732d94e21acff1238511d3e8551d531e7443f6f099fec7b81846701b4988f4bde2cf8670fc47ecfa52c
b2sums = 247e7b94ec5c00629d4db25a2bc3ab9a0aec4d118985abb889a9c28f7dde42d8fea2d6672e89aaa715f4b7bfaa2320a4b20636cfb600e0c19d68ee073aa3ec27
pkgname = deluge
@ -63,7 +65,7 @@ pkgname = deluge-gtk
depends = python-cairo
depends = python-gobject
depends = xdg-utils
depends = deluge=1:2.1.1-7
depends = deluge=1:2.1.1-8
depends = python
depends = python-rencode
depends = python-setproctitle

View File

@ -0,0 +1,116 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
Date: Thu, 29 Aug 2024 15:31:25 +0900
Subject: [PATCH] [UI] Replace deprecated cgi module with email
As PEP 594 says, cgi module is marked as deprecated
in python 3.11, and will be removed in 3.13
(actually removed at least in 3.13 rc1).
As suggested on PEP 594, replace cgi.parse_header
with email.message.EmailMessage introduced in python 3.6.
Updated test modify test_download_with_rename_sanitised
- With RFC2045 specification, Content-Disposition filenames
parameter containing slash (directory separator) must be
quoted, so changing as such.
Ref: https://peps.python.org/pep-0594/#deprecated-modules
Ref: https://peps.python.org/pep-0594/#cgi
Closes: https://github.com/deluge-torrent/deluge/pull/462
---
deluge/httpdownloader.py | 14 +++++++++-----
deluge/tests/test_httpdownloader.py | 4 ++--
deluge/ui/web/json_api.py | 6 ++++--
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py
index 700ade06bfd5..c19e3aa7ed1c 100644
--- a/deluge/httpdownloader.py
+++ b/deluge/httpdownloader.py
@@ -6,7 +6,7 @@
# See LICENSE for more details.
#
-import cgi
+import email.message
import logging
import os.path
import zlib
@@ -133,26 +133,30 @@ def request_callback(self, response):
content_disp = headers.getRawHeaders(b'content-disposition')[0].decode(
'utf-8'
)
- content_disp_params = cgi.parse_header(content_disp)[1]
- if 'filename' in content_disp_params:
- new_file_name = content_disp_params['filename']
+ message = email.message.EmailMessage()
+ message['content-disposition'] = content_disp
+ new_file_name = message.get_filename()
+ if new_file_name:
new_file_name = sanitise_filename(new_file_name)
new_file_name = os.path.join(
os.path.split(self.filename)[0], new_file_name
)
count = 1
fileroot = os.path.splitext(new_file_name)[0]
fileext = os.path.splitext(new_file_name)[1]
while os.path.isfile(new_file_name):
# Increment filename if already exists
new_file_name = f'{fileroot}-{count}{fileext}'
count += 1
self.filename = new_file_name
cont_type_header = headers.getRawHeaders(b'content-type')[0].decode()
- cont_type, params = cgi.parse_header(cont_type_header)
+ message = email.message.EmailMessage()
+ message['content-type'] = cont_type_header
+ cont_type = message.get_content_type()
+ params = message['content-type'].params
# Only re-ecode text content types.
encoding = None
if cont_type.startswith('text/'):
diff --git a/deluge/tests/test_httpdownloader.py b/deluge/tests/test_httpdownloader.py
index 8c491b68ad9f..96f740d2e5b5 100644
--- a/deluge/tests/test_httpdownloader.py
+++ b/deluge/tests/test_httpdownloader.py
@@ -212,10 +212,10 @@ async def test_download_with_rename_exists(self):
@pytest_twisted.ensureDeferred
async def test_download_with_rename_sanitised(self):
- url = self.get_url('rename?filename=/etc/passwd')
+ url = self.get_url('rename?filename="/etc/passwd"')
filename = await download_file(url, fname('original'))
assert filename == fname('passwd')
- self.assert_contains(filename, 'This file should be called /etc/passwd')
+ self.assert_contains(filename, 'This file should be called "/etc/passwd"')
@pytest_twisted.ensureDeferred
async def test_download_with_attachment_no_filename(self):
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index 3f256140e521..f148ac569cb0 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -6,7 +6,7 @@
# See LICENSE for more details.
#
-import cgi
+import email.message
import json
import logging
import os
@@ -191,7 +191,9 @@ def _on_json_request(self, request):
Handler to take the json data as a string and pass it on to the
_handle_request method for further processing.
"""
- content_type, _ = cgi.parse_header(request.getHeader(b'content-type').decode())
+ message = email.message.EmailMessage()
+ message['content-type'] = request.getHeader(b'content-type').decode()
+ content_type = message.get_content_type()
if content_type != 'application/json':
message = 'Invalid JSON request content-type: %s' % content_type
raise JSONException(message)

View File

@ -9,7 +9,7 @@ pkgname=(
deluge-gtk
)
pkgver=2.1.1
pkgrel=7
pkgrel=8
epoch=1
pkgdesc="BitTorrent client with multiple user interfaces in a client/server model"
url="https://deluge-torrent.org/"
@ -63,10 +63,12 @@ source=(
"git+https://git.deluge-torrent.org/deluge?signed#tag=deluge-$pkgver"
0001-Update-metainfo-install-path.patch
0002-Fix-data-installation-when-building-wheel.patch
0003-UI-Replace-deprecated-cgi-module-with-email.patch
)
b2sums=('950bf89a60f23e2b1d65413afcb8f71ae159092051477546c56936c092f6c3d8a345f54081d92ae3866a2194f6f2a09553bde71ba4d70b749b9abc234bdd9db5'
'864c8ca71e718e3d8cdd6021f5e3ddf82782955da6d25f9f3077a8dd59d2a8a798460c0f26fcf95b3b17d595b69c2f10b92a564c4482e3ac0ca27304dba9bd39'
'c503eface42fc12cb04086a5a77a862ee44f78ecdd6ad732d94e21acff1238511d3e8551d531e7443f6f099fec7b81846701b4988f4bde2cf8670fc47ecfa52c')
'c503eface42fc12cb04086a5a77a862ee44f78ecdd6ad732d94e21acff1238511d3e8551d531e7443f6f099fec7b81846701b4988f4bde2cf8670fc47ecfa52c'
'247e7b94ec5c00629d4db25a2bc3ab9a0aec4d118985abb889a9c28f7dde42d8fea2d6672e89aaa715f4b7bfaa2320a4b20636cfb600e0c19d68ee073aa3ec27')
validpgpkeys=(
EA01185D0E8AA00D6323A30890597A687B836BA3 # Calum Lind <calumlind@gmail.com>
)
@ -77,6 +79,9 @@ prepare() {
# Installation fixes
git apply -3 ../0001-Update-metainfo-install-path.patch
git apply -3 ../0002-Fix-data-installation-when-building-wheel.patch
# Python 3.13
git apply -3 ../0003-UI-Replace-deprecated-cgi-module-with-email.patch
}
build() {