Skip to content

Preview of text file truncated #1452

Closed

Description

@v-scharf

related #1420

Describe the bug

A clear and concise description of what the bug is.

Steps to reproduce

  1. upload txt file https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/filesForUpload/lorem.txt
  2. open preview in the right sidebar request like: remote.php/dav/spaces/spaceId/lorem.txt?scalingup=0&preview=1&a=1&processor=thumbnail&c=c5985ab688cc88362a9cfe7d9d284379&x=1200&y=1200

Expected behavior

user can see UTF characters in the preview. latin and cyrillic work fine

Actual behavior

file is truncated:

Image

I received a file with a size of 640x640, although the request was for 1200x1200.

Image

Setup

opencloud_full 3.4.0 rolling

Details

OC_XXX=somevalue
OC_YYY=somevalue
PROXY_XXX=somevalue

Additional context

Add any other context about the problem here.

Activity

  1. moved this from Qualification to Prio <= 3 in OpenCloud Team Boardon Sep 4, 2025
  2. fschade commented on Dec 16, 2025

    @fschade
    Member

    cant reproduce it (cut off), theres no text cut off using my test-instance, can we check it together?

    Image

    the size is unfortunately hardcoded, i check it right now!

    img := image.NewRGBA(image.Rect(0, 0, 640, 480))

  3. fschade commented on Dec 16, 2025

    @fschade
    Member

    @ScharfViktor ok, i checked the code, the default text preprocessor uses 640x480 as a default resolution, our default manager uses that img as source and the x & y dimensions from the url, are not meant to be size to expect, instead it is used as a max dimension and we pick the closest match from all available dimensions, this happens here and here.

    the available rectangles are:

    • "16x16"
    • "32x32"
    • "64x64"
    • "128x128"
    • "1080x1920"
    • "1920x1080"
    • "2160x3840"
    • "3840x2160"
    • "4320x7680"
    • "7680x4320"

    long story short, the max available dimension for the TxtToImageConverter is 640x480 (the source image) which results in 640x640 because it fits into "1200x1200" and its max available size is 640x640 (no upscaling).

  4. self-assigned this
    on Dec 16, 2025
  5. moved this from Prio <= 3 to In Progress in OpenCloud Team Boardon Dec 16, 2025
  6. fschade commented on Dec 16, 2025

    @fschade
    Member

    update, the cropping does not happen on macos, but in docker it happens... looks like a font rendering // calc issue to me...

    initialPoint := fixed.P(imgBounds.Min.X+margin, imgBounds.Min.Y+margin+fontSizeAsInt)

  7. rhafer commented on Dec 17, 2025

    @rhafer
    Member

    It's probably a difference between the libvips based thumbnailer and the native go based thumbnailer.

    The container builds have libvips enabled. @fschade did you local build also use libvips?

  8. fschade commented on Dec 17, 2025

    @fschade
    Member

    @rhafer thanks for the hint, i build it with the enable_vips tag, same on macOS with or without vips, nothing is cut off :(.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions