Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

TDServer.LEGAL_CHARACTERS expression allows invalid characters. #81

@bsquared

Description

@bsquared

The evaluation does not return true when invalid characters were used.

/*
    public static final String LEGAL_CHARACTERS = "abcdefghijklmnopqrstuvwxyz0123456789_$()+-/";
*/    
    public static final String LEGAL_FILENAME_CHARACTERS = "[^\\w\\d_$()/+-]*$";

    private String pathForName(String name) {
/*
        if ((name == null) || (name.length() == 0) || Pattern.matches("^" + LEGAL_CHARACTERS, name) || !Character.isLowerCase(name.charAt(0))) {
            return null;
        }
*/
        if ((name == null) || (name.length() == 0) || Pattern.matches(LEGAL_FILENAME_CHARACTERS, name) || !Character.isLowerCase(name.charAt(0))) {
            return null;
        }
        name = name.replace('/', ':');
        String result = directory.getPath() + File.separator + name + DATABASE_SUFFIX;
        return result;
    }

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