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

jrnl reads extraneous text files when reading folder journal #1692

Closed
micahellison opened this issue Feb 25, 2023 · 0 comments · Fixed by #1697
Closed

jrnl reads extraneous text files when reading folder journal #1692

micahellison opened this issue Feb 25, 2023 · 0 comments · Fixed by #1697
Labels
bug Something isn't working 📌 This can't go stale
Milestone

Comments

@micahellison
Copy link
Member

Diagnostic output

jrnl: v3.3
Python: 3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
OS: Windows 10

Current Behavior

When opening a folder journal (a journal whose path is a folder, not a file, as in FolderJournal.py), jrnl traverses through ALL txt files in the journal, whether or not they match the naming format we use (get_files method) and parses all of them as journal entries (open method).

This can lead to really strange behavior. If I have a text file like "readme.txt" in my jrnl, it suddenly becomes a jrnl entry.

It can also lead to jrnl crashing, if it can't parse the text files. See #1665 for a support case where that happens.

Expected Behavior

jrnl should only parse text files that are saved in its file naming format.

Repro Steps

I create a new dirtest jrnl in my jrnl.yaml config file:

  dirtest:
    journal: C:\temp\testing\dirtest\

I create a readme.txt file in that folder with the contents:

This is a readme

I run jrnl dirtest -1 and I get this output, but I wouldn't expect to see it:

2023-02-25 12:45:37 PM This is a readme

Debug output

DEBUG    root         Parsed args: Namespace(debug=True, preconfig_cmd=None, postconfig_cmd=None, filename=None, on_date=None, today_in_history=False, month=None, day=None, year=None, start_date=None, end_date=None, contains=None, strict=False, starred=False, limit=5, excluded=[], edit=False, delete=False, change_time=None, export=False, tags=False, short=False, config_override=[], config_file_path='', text=['dirtest'])
DEBUG    root         Reading configuration from file C:\Users\micah\.config\jrnl\jrnl.yaml
DEBUG    root         Using configuration "{'colors': {'body': 'none', 'date': 'black', 'tags': 'yellow', 'title': 'cyan'}, 'default_hour': 9, 'default_minute': 0, 'display_format': None, 'editor': 'subl -w', 'encrypt': False, 'highlight': True, 'indent_character': '', 'journals': {'dirtest': {'journal': 'C:\\temp\\testing\\dirtest\\'}}, 'linewrap': 'auto', 'tagsymbols': '#@', 'template': False, 'timeformat': '%F %r', 'version': 'v3.3'}"
DEBUG    root         Using journal name: dirtest
DEBUG    root         Updating configuration with specific journal overrides {'journal': 'C:\\temp\\testing\\dirtest\\'}
2023-02-25 12:47:51 PM This is a readme

Other Information

No response

@micahellison micahellison added bug Something isn't working 🆕 New! labels Feb 25, 2023
@micahellison micahellison changed the title jrnl reads extraneous text files in when reading folder journal type jrnl reads extraneous text files when reading folder journal Feb 25, 2023
@micahellison micahellison added 📌 This can't go stale and removed 🆕 New! labels Mar 4, 2023
@micahellison micahellison added this to the Backlog milestone Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📌 This can't go stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant