gosqasorg / asset-provenance-tracking

Node.js implementation, using Azure as a backend, of a system for Global Distributed Tracking, a free-of-charge, free-software system for building up a provenance or history of objects/assets/devices.
https://gosqas.org/
GNU Affero General Public License v3.0
5 stars 3 forks source link

[BUG] file type not stored with .stl files and probably others... #89

Closed RobertLRead closed 1 month ago

RobertLRead commented 6 months ago

it was reported by Emanuel that he could load a .stl file.

However, when he tried to download it, it didn't have the filename and the file extension.

I don't know what browser this is on. I think this is a pretty high priority.

RobertLRead commented 5 months ago

Harry, can you update this one?

RobertLRead commented 4 months ago

@chihlinc this may be a good bug for you. It is a very high priority for the Poland team. Can you please see if you can figure it out? If it makes no sense to you, please assign back to me.

RobertLRead commented 4 months ago

I believe we want to do this in CreateDevice.vue:

diff --git a/packages/frontend/components/CreateDevice.vue b/packages/frontend/components/CreateDevice.vue
index 4a3ca8b..91233b7 100644
--- a/packages/frontend/components/CreateDevice.vue
+++ b/packages/frontend/components/CreateDevice.vue
@@ -14,7 +14,7 @@
             <input type="text" class="form-control mt-3" v-model="description" required placeholder="Device Description">
             <div style="display: block;">
                 <label>Device Image (optional):    </label>
-                <input type="file" class="form-control" accept="image/*" @change="onFileChange" capture="environment" multiple />
+                <input type="file" class="form-control" accept="*" @change="onFileChange" capture="environment" multiple />
             </div>
         </div>
         <button id="submit-button" type="submit">Submit</button>

However, this is not enough. This allows you to upload a .stl file successfully, but then our system does not render it. Of course an STL file may not be renderable in a given browser, but we must allow it to be dowloaded!

So I believe that in Feed.vue:

            <div>{{ report.record.description }}</div>
            <div v-for="(url, i) in attachmentURLs[index.toString()]" :key="i">
                <!-- Image -->
                **<img v-bind:src="url" alt="Image" style="width: 150px; padding: 5px;" data-bs-toggle="modal" data-bs-target="#imageModal" @click="modalImage = url">**
            </div>
            <div style="font-size: small;">{{ new Date(report.timestamp) }}</div>
        </div>
    </div>
        <!-- The Modal to Enlarge Image -->
        <div class="modal fade" id="imageModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered modal-lg">
                 <div class="modal-content">
                        **<img v-bind:src="modalImage" alt="Image" class="img-fluid">**
                </div>
            </div>
        </div>

In the places marked in bold above, we need to find a way to allow a download of the file (whether a .stl or a .pdf, for exmape.)

chihlinc commented 3 months ago

@RobertLRead, I change the codes, by making image - renderable and other files downloadable. Btw, I did not do the testing yet.

chihlinc commented 3 months ago

@RobertLRead I think it works now, under "coco-fix-download" branch.