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

Fix loading of tracks #587

Merged
merged 1 commit into from Jul 5, 2021
Merged

Conversation

Ablu
Copy link
Contributor

@Ablu Ablu commented Apr 12, 2021

The flow seems to be:

occ maps:scan-tracks

adds the tracks to the db with $metadata = "". Then, when the UI
initially requests a specific track the metadata is generated. This
however never happens since the UI code attempts to parse the metadata
as JSON before. Fixed by checking for an empty string before (in which
case we return an empty object (the metadata will be read again later
when displaying an individual track)).

I am not sure why the metadata is read here it all. Maybe the parsing
call be be removed completly if it happens again later anyway?

Fixes: #574

The flow seems to be:
```
occ maps:scan-tracks
```
adds the tracks to the db with `$metadata = ""`. Then, when the UI
initially requests a specific track the metadata is generated. This
however never happens since the UI code attempts to parse the metadata
as JSON before. Fixed by checking for an empty string before (in which
case we return an empty object (the metadata will be read again later
when displaying an individual track)).

I am not sure why the metadata is read here it all. Maybe the parsing
call be be removed completly if it happens again later anyway?

Fixes: nextcloud#574
Signed-off-by: Erik Schilling <git@ablu.org>
@ngt-github
Copy link

I stubled upon the same Problem. However, unaware of this pullrequest, I did my own fix using try/catch in order to catch malformed json in general:

replaced line 294: this.tracks[track.id].metadata = $.parseJSON(track.metadata);
with
try { this.tracks[track.id].metadata = $.parseJSON(track.metadata); }catch(e) { this.tracks[track.id].metadata = {}; }

I am not sure if it is neccessary at all and if there will be cases of malformed json besides an empty string but I just hope for a fixed version soon. This pullrequest works for me too,

Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

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

Thanks!
This will be replaced by the Vue.JS rewrite soon anyway.

@julien-nc julien-nc merged commit 7aa4927 into nextcloud:master Jul 5, 2021
@julien-nc julien-nc mentioned this pull request Jul 5, 2021
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.

Nc21 tracks keeps loadings sign
4 participants