Skip to content

createFile() cuts text files at first line starting with "----" #31

@ferenc-hechler

Description

@ferenc-hechler

I use the following code to upload a local file to pCloud:

    apiClient = ...
    File file = new File("test.txt");

    System.out.println("FILESIZE: " + localFile.length());
    RemoteFile uploadedFile = apiClient.createFile(
        RemoteFolder.ROOT_FOLDER_ID,
        localFile.getName(),
        DataSource.create(localFile))
            .execute();
    System.out.println("UPLOADED: " + uploadedFile.size());

This code works fine, as long as the text file does not contain a line starting with '----'.
For example the following text:

Transmission Control Protocol
Functional Specification

Currently defined options include (kind indicated in octal):

Kind     Length    Meaning
----     ------    -------
 0         -       End of option list.
 1         -       No-Operation.
 2         4       Maximum Segment Size.

Specific Option Definitions

End of Option List

Uploading this file gives the following output:

FILESIZE: 348
UPLOADED: 149

and looking at the uploaded text it stops before the first line starting with "----":

Transmission Control Protocol
Functional Specification

Currently defined options include (kind indicated in octal):

Kind     Length    Meaning

So lines starting with four "-" signs are somehow misinterpreted as End-Of-Text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions