Give user a possibility to choose a policy for saving files
- The server-supplied filename from the Content-Disposition header is
used to write a file to the local working directory. But it was done
without checking if the file with that name already exists.
It means a server could silently overwrite any file in the working
directory by choosing a colliding filename.
- To prevent this possibility, add setFileConflictPolicy() and
fileConflictPolicy() API to the BaseApi class.
This API allows users to control how filename conflicts are handled
when downloading files.
The following policies are added:
* Rename (default) — appends a numeric suffix (file(1).txt, file(2).txt, ...)
until a non-conflicting name is found.
* Overwrite — overwrite the existing file.
* Error — emits a qWarning and skips writing the file.
[ChangeLog][QtOpenApi] add setFileConflictPolicy() and
fileConflictPolicy() API.
Pick-to: 6.12
Task-number: QTBUG-147643
Change-Id: I44f5cb3a7fb64490c355875708d71888a39b4937
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
| commit | de9e36b1cc0a1a88307dc4d1d973fb8f5b2ca157 |
| parent | 7145e8c60e67309f29243e7a23575df6f96a13f9 |
| author | Tatiana Borisova <tatiana.borisova@qt.io> |
| committer | Tatiana Borisova <tatiana.borisova@qt.io> |
| commit time | Fri, 26 Jun 2026 10:37:42 +0000 |
- M src/tools/qtopenapi-generator/src/main/java/org/qtproject/qt/codegen/CppQt6ClientGenerator.java
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/api-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/api-base-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/api-base-header.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/httprequest.cpp.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/httprequest.h.mustache
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/clienttest/client/doc/Doxyfile.in
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/clienttest/client/petapi.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaibaseapi.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaibaseapi.h
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaihttprequest.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaihttprequest.h
- M tests/auto/responses/client/responses/tst_responses.cpp