chore (improvement): pdf textify

This commit is contained in:
MickaelK
2026-07-11 17:10:33 +10:00
parent a0c321e464
commit 00c6c707ce
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ WORKDIR /app/
COPY --from=builder_backend /home/filestash/dist/ .
RUN apt-get update > /dev/null && \
apt-get -y upgrade > /dev/null && \
apt-get install -y --no-install-recommends ca-certificates curl ffmpeg libbrotli1 && \
apt-get install -y --no-install-recommends ca-certificates curl ffmpeg libbrotli1 poppler-utils && \
useradd filestash && \
chown -R filestash:filestash /app/ && \
find /app/data/ -type d -exec chmod 770 {} \; && \
@@ -36,4 +36,4 @@ RUN apt-get update > /dev/null && \
USER filestash
CMD ["/app/filestash"]
EXPOSE 8334
EXPOSE 8334
+2 -1
View File
@@ -11,7 +11,7 @@ import (
)
func PDF(r io.ReadCloser) (io.ReadCloser, error) {
tmpName := fmt.Sprintf("/tmp/pdf_%d.docx", rand.Intn(1000000))
tmpName := fmt.Sprintf("/tmp/pdf_%d.dat", rand.Intn(1000000))
defer os.Remove(tmpName)
f, err := os.OpenFile(tmpName, os.O_CREATE|os.O_WRONLY, os.ModePerm)
if err != nil {
@@ -29,6 +29,7 @@ func PDF(r io.ReadCloser) (io.ReadCloser, error) {
cmd.Stdout = out
err = cmd.Run()
if err != nil {
Log.Debug("pkg::textify action=pdf err=%s", err.Error())
return nil, err
}
return NewReadCloserFromReader(out), nil