mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
Handle empty files in content
This commit is contained in:
@@ -142,7 +142,9 @@ public class ContentResource {
|
||||
try {
|
||||
byte[] buffer = new byte[HEAD_BUFFER_SIZE];
|
||||
int length = stream.read(buffer);
|
||||
if (length < buffer.length) {
|
||||
if (length < 0) { // empty file
|
||||
return new byte[]{};
|
||||
} else if (length < buffer.length) {
|
||||
return Arrays.copyOf(buffer, length);
|
||||
} else {
|
||||
return buffer;
|
||||
|
||||
Reference in New Issue
Block a user