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

Store docs locally #119

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Store docs locally #119

merged 2 commits into from
Sep 17, 2024

Conversation

ofermend
Copy link
Collaborator

fixed issue with detect_file_type
added store_docs configuration option to store all file content locally

added store_docs configuration option to store all file content locally
core/utils.py Outdated
if mime_type in ['text/html', 'application/xml', 'text/xml']:
with open(file_path, 'r', encoding='utf-8') as file:
first_1024_bytes = file.read(1024)
if '<html' in first_1024_bytes.lower() and '</html>' in first_1024_bytes.lower():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this looking for the closing html tag in the first 1024 bytes? Shouldn't that be looked for in the last 1024 bytes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually okay since usually XML files look this way (very close start/end HTML tags), but let me see if I can figure out a more robust detection option.

Copy link
Collaborator

@justinhayes justinhayes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left 1 comment. Once that is resolved then I'm OK to approve.

@ofermend ofermend merged commit ca23dcb into main Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants