Skip to content

file.read(bytes) is limited to 16kb for seemingly no reason #29

@Lemmmy

Description

@Lemmmy

file.read(bytes) (as added by this PR) is limited to 16 kB on this line:

https://github.com/SquidDev-CC/CC-Tweaked/blob/a0d71cb3ad5cd7279ab9f5be8d79d89074c2e5dd/src/main/java/dan200/computercraft/core/apis/handles/EncodedInputHandle.java#L114

The result of this is an unhelpful "Count out of range" error.

One of three options would be preferable here:

  • Remove the limit. It doesn't make much sense to be limiting at all in this case, as you can just file.readAll() just as maliciously.
  • Increase the limit. 16 kB is a very low value for a limit like this. It could be increased to something more reasonable, perhaps in the megabytes range.
  • Change the error message. The error message is entirely undescriptive here - it makes the user think they are trying to read more bytes than the file has, which is definitely not the case here. It could instead inform the user that they can only read this stupidly arbitrary number of bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn extension of a feature or a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions