Skip to content

v2.12.3 WikiText bug: spaces not replaced with underscores in filename #2362

@bruvellu

Description

@bruvellu

IMPORTANT

  • Package: net.gsantner.markor
  • Version: v2.12.3 (152) (Sorry, I couldn't test the latest commits on the master branch).
  • Flavor: Gplay (release)
  • Build date: 2024-07-20T14:14Z
  • ISource: Google Play
  • VCS Hash: 275f488
  • VCS Msg: Markor v2.12.3 (152)
  • I accept that this issue will be closed without further notice in case I didn't describe the problem including general information, or didn't search for similar issues & requests.

Explain the Problem

When creating a new Wikitext/Zim file with a title that contains whitespaces, the spaces are not replaced by underscores in the filename. But Zim does not support spaces in filenames.

For example, creating a new file with a title This is a new file makes a file named This is a new file.txt instead of This_is_a_new_file.txt.

This used to work on v2.12.0, but stopped after the updates to the NewFileDialog a few months ago (f35383a). I believe the relevant code was this one:

private String getFileNameWithoutExtension(String typedFilename, int selectedTemplatePos) {
    if (selectedTemplatePos == 7) {
        // Wikitext files always use underscores instead of spaces
        return typedFilename.trim().replace(' ', '_');
    }
    return typedFilename.trim();
}

Steps to Reproduce

  1. Click on the big red button with a +
  2. Write a title with spaces "This is a title"
  3. Select .txt extension, Wikitext / Zim type, and zim-wiki-empty.txt template
  4. Click OK

Praise

Thank you so much! As a Zim enthusiast and heavy user, Markor has been a game-changer for my mobile note-taking.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions