use correct convex function and change how the edit html gets the file id

This commit is contained in:
2026-04-01 21:05:07 +02:00
parent 5bbc100d83
commit 65951a23ce
3 changed files with 17 additions and 14 deletions
+7 -7
View File
@@ -44,7 +44,7 @@
</tr>
<tr>
<th scope="row">File ID</th>
<td><code>{{ file.file_id }}</code></td>
<td><code>{{ file_id }}</code></td>
</tr>
<tr>
<th scope="row">Uploaded at</th>
@@ -88,7 +88,7 @@
<div class="save-row">
<button id="saveBtn" class="btn" type="button">Save changes</button>
<a class="btn btn-ghost" href="{{ url_for('side_main.file_info', file_id=file.file_id) }}">View info</a>
<a class="btn btn-ghost" href="{{ url_for('side_main.file_info', file_id=file_id) }}">View info</a>
<a class="btn btn-ghost" href="{{ url_for('side_main.files_list') }}">Back to files</a>
</div>
<div class="status-row"><span id="status" class="status"></span></div>
@@ -102,7 +102,7 @@
</main>
<script>
const fileId = '{{ file.file_id }}';
const fileId = '{{ file_id }}';
const initialExpires = '{{ file.expires_at }}';
const expiresMode = document.getElementById('expiresMode');
const customWrap = document.getElementById('customWrap');
@@ -173,8 +173,8 @@
setStatus('Saving...');
try {
const response = await fetch(`/api/files/${encodeURIComponent(fileId)}/edit`, {
method: 'POST',
const response = await fetch(`/api/file/${encodeURIComponent(fileId)}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ file_name: fileName, note, expires }),
});
@@ -194,8 +194,8 @@
setStatus('Deleting...');
try {
const response = await fetch(`/api/files/${encodeURIComponent(fileId)}/delete`, {
method: 'POST',
const response = await fetch(`/api/file/${encodeURIComponent(fileId)}`, {
method: 'DELETE',
});
const data = await response.json();
if (!response.ok || !data.ok) {