Skip to content

Commit

Permalink
fix: The full file path is not visible when Contract Files are upload…
Browse files Browse the repository at this point in the history
…ed (#735)

Co-authored-by: Michele Franchi <michele.franchi933@gmail.com>
  • Loading branch information
janmichek and michele-franchi committed Apr 24, 2024
1 parent ab51619 commit 3e08d3b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/ContractFileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:key="index"
class="contract-file-list__item">
<span @click="selectEntryFile(file, index)">
{{ file.webkitRelativePath || file.name }}
{{ file.webkitRelativePath }}
<app-chip
v-if="index === entryFile.index"
class="contract-file-list__chip"
Expand Down
6 changes: 5 additions & 1 deletion src/components/ContractsFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function drop(event) {
}
function selectEntryFile(file, index) {
const name = file.webkitRelativePath || file.name
const name = file.webkitRelativePath
entryFile.value = { index, name }
emit('update:entry-file', name)
}
Expand Down Expand Up @@ -133,6 +133,10 @@ function getFileEntry(entry, files) {
function getSingleFile(fileEntry, files) {
return new Promise(resolve => {
fileEntry.file(file => {
// chrome workaround to manually set webkitRelativePath
Object.defineProperty(file, 'webkitRelativePath', {
value: fileEntry.fullPath.substring(1),
})
files.push(file)
selectedFiles.value.push(file)
resolve(file)
Expand Down
2 changes: 1 addition & 1 deletion src/stores/contractVerification.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useContractVerificationStore = defineStore('useContractVerification
form.append('entryFile', entryFile)

Array.from(sourceFiles).forEach(file => {
form.append('sourceFiles', file)
form.append('sourceFiles', file, file.webkitRelativePath)
})

const data = await axios.post(`${CONTRACT_VERIFICATION_SERVICE_URL}/contracts/${contractId}`, form).catch(error => {
Expand Down

0 comments on commit 3e08d3b

Please sign in to comment.