1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/apps/metadata.c b/apps/metadata.c
index 1680fd7..f8df7b1 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -327,6 +327,8 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
         return false;
     }

+    strlcpy(id3->path, trackname, sizeof(id3->path));
+
     if (!entry->parse_func(fd, id3))
     {
         DEBUGF("parsing %s failed (format: %s)", trackname, entry->label);
@@ -334,7 +336,6 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
     }

     lseek(fd, 0, SEEK_SET);
-    strlcpy(id3->path, trackname, sizeof(id3->path));
     /* We have successfully read the metadata from the file */
     return true;
 }