Skip to content

download error if file exists #620

Closed
@chenhucxc

Description

@chenhucxc
/**
     * Create a file using java.io API
     */
    private File createFileInAppSpecificDir(String filename, String savedDir) {
        File newFile = new File(savedDir, filename);
        try {
            boolean rs = newFile.createNewFile();
            if (rs) {
                return newFile;
            } else {
                logError("It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'");
            }
        } catch (IOException e) {
            e.printStackTrace();
            logError("Create a file using java.io API failed ");
        }
        return null;
    }

should add this

if (newFile.exists()) {
            return newFile;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions