Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kosarko
Copy link
Member

@kosarko kosarko commented May 5, 2025

This contains the following changes:

Paurikova2 and others added 9 commits April 16, 2025 08:42
* added authentication by email and password

* add required authentification options, log successful authentification

* added authentification to file-preview script tests

* fix failed tests - added authorization and succesful authorizatiom msg, improved errors check for unauthorized access
* added property for composing file-preview

* added property to the right place

* renamed property for file-preview composing

* renamed property in IT test
* removed creating of tempFile from inputstream, used imputstream directly

* added methods documentation

* added safe way how to addFilePath

* log error when path is not added properly
* Called the method for the updated items bitstream metadata wasn't called after the bitstream was updated, so that items bitstream metadata wasn't correctly updated.

* Updated the delete bitstream integration test to check if the `local.has.files` metadata was updated correctly.
* remove duplicate dependency element with identical content (warnings in build)

(cherry picked from commit 59cee27)

* Issue 1165: Handle PaginantionException in Clarin licences search requests (#1184)

* Issue 1165: Handle PaginantionException in Clarin licences search requests

* resolve MR comments

---------

Co-authored-by: Milan Kuchtiak <[email protected]>
(cherry picked from commit 1778714)

* Issue 1055: fixed security issue for downloading file with non anonymous license (#1188)

* Issue 1055: fixed security issue for downloading file with a license that requires authenticated user, also change ClarinLicense confirmation type from Integer to Enum (this reqired some refactoring)

* fixed failing tests

* add unit test for not authenticated user trying to get token for licence not allowed for anonymous user

* inmprove unit test

* resolve MR comments

* typo: backwards compatibility -> backward compatibility

---------

Co-authored-by: Milan Kuchtiak <[email protected]>
(cherry picked from commit 53e88cb)

* Issue 1186: catch DSpaceBadRequestException rather than BadRequestException (#1187)

* Issue 1186: catch DSpaceBadRequestException rather than BadRequestException

* resolve test failures

* improve javadoc

* resolve MR comment

---------

Co-authored-by: Milan Kuchtiak <[email protected]>
Co-authored-by: Ondřej Košarko <[email protected]>
(cherry picked from commit 77fc4b0)

* Issue #1190 - fixed Server error  (#1193)

* Issue 1190: fixed internal server error, when context.commit() was called multiple times in search request

* Issue 1190: fixed internal server error, when context.commit() was called multiple times in search request

* unnecessary whitespace

* update unit test

* small improvements

---------

Co-authored-by: Milan Kuchtiak <[email protected]>
(cherry picked from commit 6638293)

* Shortref v7 (#1194)

* Anonymous users should be able to use shortener

* Update possible only with a valid token

* updated handle returned with usable token

additional cleanup - magicurl is an implementation detail and should not
be serialized

* checkstyle

* createHandle would throw ConstraintViolation

update the tests to use shortener.handle.prefix
handle validation - subprefix has a default, should not be required

* test blacklist/whitelist

checkstyle and license

* Address PR review comments

doc + default

(cherry picked from commit 2e3bd80)

* Pull request review comment

use a recent version of commons-lang

* Shortener blacklist test

- provide more guidance in the config file
- change the default to match lindat prod

---------

Co-authored-by: Øyvind Gjesdal <[email protected]>
Co-authored-by: kuchtiak-ufal <[email protected]>
* check if current user is defined

* removed empty line

* throw RESTAuthorizationException
these are changes from lindat-2025.04.14600125143
@kosarko kosarko requested a review from Copilot May 5, 2025 14:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates changes from the latest Dataquest release to update file preview handling, improve configuration for authenticated file preview composition, and adjust URL generation to use handles. Key changes include:

  • Enabling file preview composition via configuration in the REST repository tests
  • Updating tests and command options for file preview authentication
  • Refactoring extraction methods in archive processing and updating URL generation logic

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java Adds configuration for allowing file preview composition in tests
dspace-server-webapp/src/test/java/org/dspace/app/rest/ExternalHandleRestRepositoryIT.java Updates host and URL blacklist configuration and tests
dspace-server-webapp/src/test/java/org/dspace/app/rest/BitstreamRestRepositoryIT.java Verifies updated metadata propagation for item file status
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/RandomStringGeneratorImpl.java Corrects import for RandomStringUtils
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/MetadataBitstreamRestRepository.java Injects and uses ConfigurationService to conditionally generate preview content
dspace-api/src/test/java/org/dspace/scripts/filepreview/FilePreviewIT.java Adds tests to check for proper authentication error messages during file-preview script runs
dspace-api/src/main/java/org/dspace/api/DSpaceApi.java Adjusts URL generation to use handles instead of UUIDs
Other files Similar updates for handling authentication and null checks, as well as refactoring archive extraction logic
Files not reviewed (1)
  • dspace/config/clarin-dspace.cfg: Language not supported
Comments suppressed due to low confidence (2)

dspace-api/src/main/java/org/dspace/scripts/filepreview/FilePreview.java:102

  • After committing and completing the context, the finally block checks if the context is still valid to call abort(). This may inadvertently abort a successfully committed context; consider adjusting the cleanup logic to only abort if the context wasn’t finalized.
Context context = new Context();

dspace-api/src/main/java/org/dspace/content/PreviewContentServiceImpl.java:385

  • [nitpick] The refactored extractFile method now processes the archive directly from the inputStream, which assumes the stream is ready and not buffered for multiple reads. It is recommended to ensure that the inputStream supports this one-pass operation or to add a mechanism for stream resetting if needed.
if (ARCHIVE_TYPE_TAR.equals(fileType)) {

@kosarko kosarko merged commit 7e8e728 into clarin-v7 May 5, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants