Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file downloader algo duplicating file's extension #60543

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicogodet
Copy link
Member

Fixes #60528

User can provide a properly named temporary filepath (filename + extension) and the logic applied in current alg is not necessary and can create issues if this alg is called in a larger process: the output specified miss match the filename created on disk

@github-actions github-actions bot added this to the 3.42.0 milestone Feb 11, 2025
Copy link

github-actions bot commented Feb 11, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 9490d6a)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 9490d6a)

@alexbruy
Copy link
Contributor

Could you please add test?

@nicogodet
Copy link
Member Author

nicogodet commented Feb 11, 2025

@alexbruy I can. Is it OK to use QgsProcessingUtils::generateTempFilename() in tests ?
I see other test use QDir::tempPath() + "/filename.ext"
To properly test this change, it would be better to use QgsProcessingUtils::generateTempFilename()

Test will be added to existing one:

void TestQgsProcessingAlgsPt2::fileDownloader()

  const QString outputFileName = QgsProcessingUtils::generateTempFilename( QStringLiteral( "qgis_version.txt" ), *context );
  parameters.insert( QStringLiteral( "OUTPUT" ), outputFileName );

  results = alg->run( parameters, *context, &feedback, &ok );
  QVERIFY( ok );
  // compare result filename is the same as provided
  QCOMPARE( outputFileName, results.value( QStringLiteral( "OUTPUT" ) ).toString() );

I'm not a c++ dev...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File downloader alg can create a file with duplicated extension
2 participants