docspell icon indicating copy to clipboard operation
docspell copied to clipboard

API excepts a longer filename than is excepted by the database

Open tiborrr opened this issue 11 months ago • 2 comments

You can provide a string to filename longer than 254 characters. This problem should be handled by the API because currently you do not get any error if you provide this data.

docspell-restserver  | 2025.01.30 12:08:32:0000 [io-comp...] [ERROR] docspell.store.impl.DoobieLogging.run:30 - SQL exec failed: INSERT INTO job (jid, task, group_, args, subject, submitted, submitter, priority, state, retries, progress, tracker, worker, started, finished, startedmillis) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) (List(Ident(REDACTED), Ident(process-item), Ident(1), {"meta":{"collective":1,"itemId":null,"language":"eng","direction":"incoming","sourceAbbrev":"webapp","folderId":null,"validFileTypes":[],"skipDuplicate":false,"fileFilter":"SOME_FILTER","tags":[],"reprocess":false,"attachmentsOnly":false,"customData":{"SOME_CUSTOM_DATA"}},"files":[{"name":"REALLY_LONGNAME","fileMetaId":{"collective":1,"category":"attachmentsource","id":"REDACTED"}}]}, REALLY_LONGNAME), Ident(REDACTED), High, Waiting, 0, 0, Some(Ident(REDACTED)), None, None, None, None))
docspell-restserver  | org.postgresql.util.PSQLException: ERROR: value too long for type character varying(254)
docspell-restserver  |  at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
docspell-restserver  |  at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412)
docspell-restserver  |  at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371)
docspell-restserver  |  at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502)
docspell-restserver  |  at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419)
docspell-restserver  |  at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:194)
docspell-restserver  |  at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:155)
docspell-restserver  |  at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
docspell-restserver  |  at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
docspell-restserver  |  at doobie.free.KleisliInterpreter$PreparedStatementInterpreter.$anonfun$executeUpdate$5(kleisliinterpreter.scala:909)
docspell-restserver  |  at doobie.free.KleisliInterpreter$PreparedStatementInterpreter.$anonfun$executeUpdate$5$adapted(kleisliinterpreter.scala:909)
docspell-restserver  |  at doobie.free.KleisliInterpreter.$anonfun$primitive$2(kleisliinterpreter.scala:107)
docspell-restserver  |  at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
docspell-restserver  |  at $anonfun$tailRecM$1 @ doobie.util.transactor$Transactor$$anon$4.$anonfun$apply$4(transactor.scala:165)

tiborrr avatar Jan 30 '25 11:01 tiborrr

We can also remove the arbitrary file name limit imho on the db

eikek avatar Jan 30 '25 12:01 eikek

Sounds good to me. I was not planning on exposing this API externally.

tiborrr avatar Jan 31 '25 20:01 tiborrr