Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patcher does not check for illegal characters in output filename #632

Closed
nobuyukinyuu opened this issue Jun 3, 2021 · 3 comments · Fixed by #1029
Closed

Patcher does not check for illegal characters in output filename #632

nobuyukinyuu opened this issue Jun 3, 2021 · 3 comments · Fixed by #1029

Comments

@nobuyukinyuu
Copy link

🎯 Subject of the issue

As stated in title. Fonts which have fullnames containing characters illegal to the filesystem are not accounted for, and will cause the patcher to fail when producing final output. This could be worked around with an output file flag, or code to substitute illegal characters before final output.

🔧 Your Setup

  • Which font are you using ?
    int10h -- Px437 DOS/V re. JPN16 (Px437_DOS-V_re_JPN16.ttf)

  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)?
    Windows Terminal 1.8

  • Are you using OS X, Linux or Windows? And which specific version or distribution?
    Windows 10. The issue most likely exists (with slight variants in allowed characters) for all systems.

@Finii
Copy link
Collaborator

Finii commented Feb 23, 2022

The font names should (imho) change to be the postscript names of that fonts (see #722).
That would solve your issue en passant.

Unfortunately changing the font file name will probably upset people ;)

But you are right and I should create a proper PR and not only a discussion.

@Finii
Copy link
Collaborator

Finii commented Feb 23, 2022

OH MY!... read that incorrectly. Of course the PS name limit is enough also for file names

Ignore this comment.

Ah, this would be not enough...

    @staticmethod   
    def postscript_char_filter(name):
        """Filter out characters that are not allowed in Postscript names"""
        # The name string must be restricted to the printable ASCII subset, codes 33 to 126,
        # except for the 10 characters '[', ']', '(', ')', '{', '}', '<', '>', '/', '%'
        out = ""
        for c in name:
            if c in '[](){}<>/%' or ord(c) < 33 or ord(c) > 126:
                continue
            out += c
        return out

I will add this Issue to the discussion.

Edit: 'Remove' this comment

Finii added a commit that referenced this issue Dec 22, 2022
[why]
The filename is determined by the font (family) name. The font name
might include characters that are forbidden to use in filenames.

[how]
Filter output filesnames and prevent any character that is likely
forbidden under Windows.
Also prevent control characters.

Translate Windows path separators to posix.

Fixes: #632

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this issue Dec 22, 2022
[why]
The filename is determined by the font (family) name. The font name
might include characters that are forbidden to use in filenames.

[how]
Filter output filesnames and prevent any character that is likely
forbidden under Windows.
Also prevent control characters.

Translate Windows path separators to posix.

Fixes: #632

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2023
LNKLEO pushed a commit to LNKLEO/Nerd that referenced this issue Nov 24, 2023
[why]
The filename is determined by the font (family) name. The font name
might include characters that are forbidden to use in filenames.

[how]
Filter output filesnames and prevent any character that is likely
forbidden under Windows.
Also prevent control characters.

Translate Windows path separators to posix.

Fixes: ryanoasis#632

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@nobuyukinyuu @Finii and others