[MGNLRES-346] Text files stored incorrectly as binary Created: 03/Mar/20  Updated: 29/Mar/22  Resolved: 16/Mar/20

Status: Closed
Project: Magnolia Resources Module
Component/s: None
Affects Version/s: 3.0
Fix Version/s: 3.0, 3.0.1

Type: Bug Priority: Neutral
Reporter: Rishab Dhar Assignee: Rishab Dhar
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: 5h Remaining Estimate: 5h
Σ Time Spent: 0.05d Time Spent: 0.05d
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: XML File resources.test.foo..xml_actual.xml     XML File resources.test.foo..xml_expected.xml     XML File resources.test.foo..yaml_actual.xml     XML File resources.test.foo..yaml_expected.xml    
Issue Links:
relation
is related to MAGNOLIA-7741 IndexOutOfBoundsException when upload... Closed
supersession
supersedes MGNLRES-334 Resource uploaded via UI is treated a... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLRES-347 Fix Action availability for Edit and ... Sub-task Closed Rishab Dhar  
MGNLRES-348 Remove hardcoded labels for resources... Sub-task Closed Rishab Dhar  
MGNLRES-349 Improvement AddResourceAction and Res... Sub-task Closed Rishab Dhar  
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: UI Framework 18, UI Framework 19
Story Points: 8
Team: Nucleus

 Description   

The resources app allows a user to upload both binary files - images/videos, and text files - plaintext, yaml, etc.

Expected—working as of 6.1:

  1. Binary files are stored under a sub-node named binary of node-type mgnl:resource, with file content stored as JCR Binary property named jcr:data.
  2. Uploaded text files are stored directly under the content node, with file content stored as JCR String property named text, in plain text.
  3. In addition to plain-text files (text/plain / .txt), XML and YAML files should be treated as text files.

Actual:

  1. Uploaded plain text and YAML files have a text property set, but with content stored as a JCR Binary property.
  2. Uploaded XML files are completely treated as binary files instead of text files.

The info.magnolia.resources.app.data.ResourcePropertySetFactory manages the creation of node and setting appropriate properties for a file uploaded in resources app.
Old implementation should be ported from ResourcesContentConnector, and unit tests should be ported as well.

See also attached exports for actual/expected structure for comparison.



 Comments   
Comment by Rishab Dhar [ 16/Mar/20 ]
  • Added hardcoded known text mimeTypes conforming to this regex pattern
    ./(x-)(css|csv|html|plain|txt|javascript|xml|yaml|yml|ftl|json|bpmn|dtd|jocl|lsp|lst|ltx|xsb|xsd)
  • Text mimeType detection is moved to info.magnolia.resources.app.data.ResourceHelper with Unit tests
  • Storing of text mimeType files in text property is handled in info.magnolia.resources.app.action.UploadResourceAction
Comment by Adam Siska [ 23/Apr/20 ]

Added x-java-properties into 3.0.1.

Generated at Mon Feb 12 06:49:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.