diff --git a/twine/repository.py b/twine/repository.py
index dc473aa..ae57821 100644
--- a/twine/repository.py
+++ b/twine/repository.py
@@ -17,6 +17,9 @@ import requests
 from requests_toolbelt.multipart import MultipartEncoder
 
 
+KEYWORDS_TO_NOT_FLATTEN = set(["gpg_signature", "content"])
+
+
 class Repository(object):
     def __init__(self, repository_url, username, password):
         self.url = repository_url
@@ -30,11 +33,12 @@ class Repository(object):
     def _convert_data_to_list_of_tuples(data):
         data_to_send = []
         for key, value in data.items():
-            if isinstance(value, (list, tuple)):
+            if (key in KEYWORDS_TO_NOT_FLATTEN or
+                    not isinstance(value, (list, tuple))):
+                data_to_send.append((key, value))
+            else:
                 for item in value:
                     data_to_send.append((key, item))
-            else:
-                data_to_send.append((key, value))
         return data_to_send
 
     def register(self, package):

Bug in uploading signatures (again)
This time the bug originates from https://github.com/a-tal/twine/commit/13c83237246fe00c67b2e4ce72e8a935f89f9ee0 and the refactor.

Because that flattens all values that are sequences, it happens to flatten the `gpg_signature` field. That causes two parts to be for the `gpg_signature` which in turn translates to a list when parsed by PyPI and causes a 500 because PyPI tries to call a string operation on a list.
diff --git a/tests/test_repository.py b/tests/test_repository.py
new file mode 100644
index 0000000..3b8d84b
--- /dev/null
+++ b/tests/test_repository.py
@@ -0,0 +1,49 @@
+# Copyright 2015 Ian Cordasco
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from twine import repository
+
+
+def test_gpg_signature_structure_is_preserved():
+    data = {
+        'gpg_signature': ('filename.asc', 'filecontent'),
+    }
+
+    tuples = repository.Repository._convert_data_to_list_of_tuples(data)
+    assert tuples == [('gpg_signature', ('filename.asc', 'filecontent'))]
+
+
+def test_content_structure_is_preserved():
+    data = {
+        'content': ('filename', 'filecontent'),
+    }
+
+    tuples = repository.Repository._convert_data_to_list_of_tuples(data)
+    assert tuples == [('content', ('filename', 'filecontent'))]
+
+
+def test_iterables_are_flattened():
+    data = {
+        'platform': ['UNKNOWN'],
+    }
+
+    tuples = repository.Repository._convert_data_to_list_of_tuples(data)
+    assert tuples == [('platform', 'UNKNOWN')]
+
+    data = {
+        'platform': ['UNKNOWN', 'ANOTHERPLATFORM'],
+    }
+
+    tuples = repository.Repository._convert_data_to_list_of_tuples(data)
+    assert tuples == [('platform', 'UNKNOWN'),
+                      ('platform', 'ANOTHERPLATFORM')]

pip install -e .
parse_log_pytest
pytest
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
execnet==2.1.1
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1734472117206/work
pkginfo==1.12.1.2
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
requests==2.32.3
requests-toolbelt==1.0.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
-e git+https://github.com/pypa/twine.git@5c06ed2049b633fe7f0b0e27df32d2715614ab3a#egg=twine
typing_extensions==4.13.0
urllib3==2.3.0

name: twine
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - coverage==7.8.0
      - execnet==2.1.1
      - idna==3.10
      - pkginfo==1.12.1.2
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - requests==2.32.3
      - requests-toolbelt==1.0.0
      - typing-extensions==4.13.0
      - urllib3==2.3.0
prefix: /opt/conda/envs/twine

tests/test_repository.py::test_gpg_signature_structure_is_preserved tests/test_repository.py::test_content_structure_is_preserved
tests/test_repository.py::test_iterables_are_flattened
twine/repository.py
twine/repository.py