Fossil SCM
For /uvlist, check if any file has been chosen before submitting the form.
Commit
4a8a7742da8206439d27592421baaccf6233c7051dcc83ce6b5613d46413c6dc
Parent
cb3421c493b959e…
1 file changed
+11
-4
+11
-4
| --- src/unversioned.c | ||
| +++ src/unversioned.c | ||
| @@ -561,14 +561,21 @@ | ||
| 561 | 561 | blob_reset(&content); |
| 562 | 562 | db_end_transaction(0); |
| 563 | 563 | CX("<div>Added: %h</div>", zName); |
| 564 | 564 | } |
| 565 | 565 | form_begin("enctype='multipart/form-data'", "%R/uvlist"); |
| 566 | - CX("<label for='uvupload'>Upload unversioned file:</label>"); | |
| 567 | - CX("<input type='file' id='uvupload' name='f'/>"); | |
| 568 | - CX("<input type='submit' value='Upload'/>"); | |
| 569 | - CX("</form>"); | |
| 566 | + @ <label for='uvupload'>Upload unversioned file:</label> | |
| 567 | + @ <input type='file' id='uvupload' name='f'/> | |
| 568 | + @ <input type='submit' id='uvsubmit' value='Upload'/> | |
| 569 | + @ </form> | |
| 570 | + @ <script nonce='%h(style_nonce())'>;/* unversioned.c:%d(__LINE__) */ | |
| 571 | + @ document.getElementById('uvsubmit').onclick = function(){ | |
| 572 | + @ var bNofile = !document.getElementById('uvupload').value; | |
| 573 | + @ if (bNofile) alert('Please select a file'); | |
| 574 | + @ return !bNofile; | |
| 575 | + @ } | |
| 576 | + @ </script> | |
| 570 | 577 | } |
| 571 | 578 | |
| 572 | 579 | /* |
| 573 | 580 | ** WEBPAGE: uvlist |
| 574 | 581 | ** |
| 575 | 582 |
| --- src/unversioned.c | |
| +++ src/unversioned.c | |
| @@ -561,14 +561,21 @@ | |
| 561 | blob_reset(&content); |
| 562 | db_end_transaction(0); |
| 563 | CX("<div>Added: %h</div>", zName); |
| 564 | } |
| 565 | form_begin("enctype='multipart/form-data'", "%R/uvlist"); |
| 566 | CX("<label for='uvupload'>Upload unversioned file:</label>"); |
| 567 | CX("<input type='file' id='uvupload' name='f'/>"); |
| 568 | CX("<input type='submit' value='Upload'/>"); |
| 569 | CX("</form>"); |
| 570 | } |
| 571 | |
| 572 | /* |
| 573 | ** WEBPAGE: uvlist |
| 574 | ** |
| 575 |
| --- src/unversioned.c | |
| +++ src/unversioned.c | |
| @@ -561,14 +561,21 @@ | |
| 561 | blob_reset(&content); |
| 562 | db_end_transaction(0); |
| 563 | CX("<div>Added: %h</div>", zName); |
| 564 | } |
| 565 | form_begin("enctype='multipart/form-data'", "%R/uvlist"); |
| 566 | @ <label for='uvupload'>Upload unversioned file:</label> |
| 567 | @ <input type='file' id='uvupload' name='f'/> |
| 568 | @ <input type='submit' id='uvsubmit' value='Upload'/> |
| 569 | @ </form> |
| 570 | @ <script nonce='%h(style_nonce())'>;/* unversioned.c:%d(__LINE__) */ |
| 571 | @ document.getElementById('uvsubmit').onclick = function(){ |
| 572 | @ var bNofile = !document.getElementById('uvupload').value; |
| 573 | @ if (bNofile) alert('Please select a file'); |
| 574 | @ return !bNofile; |
| 575 | @ } |
| 576 | @ </script> |
| 577 | } |
| 578 | |
| 579 | /* |
| 580 | ** WEBPAGE: uvlist |
| 581 | ** |
| 582 |