CC: Tweaked

CC: Tweaked

42M Downloads

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

Lemmmy opened this issue · 1 comments

commented

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.
commented

Fixed in a427930.