Skip to content

Commit

Permalink
Merge branch 'main' into feat/DEV-4306-footnote-standoff
Browse files Browse the repository at this point in the history
  • Loading branch information
siers authored Dec 12, 2024
2 parents 47af79e + a6c8f2b commit 2a9a56a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ object ValueContentV2 {
for {
sipiService <- ZIO.service[SipiService]
assetId <- ZIO
.fromEither(AssetId.from(filename.substring(0, filename.indexOf('.'))))
.fromEither(AssetId.fromFilename(filename))
.mapError(msg => BadRequestException(s"Invalid value for 'fileValueHasFilename': $msg"))
meta <- sipiService.getFileMetadataFromDspIngest(shortcode, assetId).mapError {
case NotFoundException(_) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ import org.knora.webapi.slice.admin.domain.model.KnoraProject.Shortcode
object MaintenanceRequests {

type AssetId = String Refined MatchesRegex["^[a-zA-Z0-9-_]{4,}$"]
object AssetId extends RefinedTypeOps[AssetId, String]
object AssetId extends RefinedTypeOps[AssetId, String] {

def fromFilename(filename: String): Either[String, AssetId] = {
val withoutFileExtension =
if filename.contains(".") then filename.substring(0, filename.indexOf('.')) else filename
AssetId.from(withoutFileExtension)
}
}

final case class Dimensions(width: Int Refined Positive, height: Int Refined Positive)

Expand Down

0 comments on commit 2a9a56a

Please sign in to comment.