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

TDServer.LEGAL_CHARACTERS expression allows invalid characters. #81

Open
bsquared opened this issue Nov 14, 2012 · 0 comments
Open

TDServer.LEGAL_CHARACTERS expression allows invalid characters. #81

bsquared opened this issue Nov 14, 2012 · 0 comments

Comments

@bsquared
Copy link
Contributor

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;
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant