Fossil

Check-in [2d4fd55f]
Login

Check-in [2d4fd55f]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add ability to upload unversioned files via the /uvlist page.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2d4fd55fee5c4a142b7653de43673d4919249bbfd9e59512b24f722a1088d09f
User & Date: stephan 2024-06-25 18:10:11
Context
2024-06-29
22:32
In the /uvlist upload process, use %h instead of %s to render the newly-uploaded file's name. ... (check-in: d1b0ccf1 user: stephan tags: trunk)
12:54
Add missing columns to the schema during rebuild. ... (check-in: f302d31f user: tsbg tags: rebuild-fix)
2024-06-25
18:10
Add ability to upload unversioned files via the /uvlist page. ... (check-in: 2d4fd55f user: stephan tags: trunk)
09:33
Ensure that the unversioned table exists if an upload is triggered via /uvlist. ... (Closed-Leaf check-in: 3aa57a20 user: stephan tags: uv-upload)
06:30
Update to the latest pikchr in order to fix the bug in "with .start at ..." positioning. ... (check-in: 390e0013 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.mk.

269
270
271
272
273
274
275

276
277
278
279
280
281
282
  $(SRCDIR)/sounds/d.wav \
  $(SRCDIR)/sounds/e.wav \
  $(SRCDIR)/sounds/f.wav \
  $(SRCDIR)/style.admin_log.css \
  $(SRCDIR)/style.chat.css \
  $(SRCDIR)/style.fileedit.css \
  $(SRCDIR)/style.pikchrshow.css \

  $(SRCDIR)/style.wikiedit.css \
  $(SRCDIR)/tree.js \
  $(SRCDIR)/useredit.js \
  $(SRCDIR)/wiki.wiki

TRANS_SRC = \
  $(OBJDIR)/add_.c \







>







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
  $(SRCDIR)/sounds/d.wav \
  $(SRCDIR)/sounds/e.wav \
  $(SRCDIR)/sounds/f.wav \
  $(SRCDIR)/style.admin_log.css \
  $(SRCDIR)/style.chat.css \
  $(SRCDIR)/style.fileedit.css \
  $(SRCDIR)/style.pikchrshow.css \
  $(SRCDIR)/style.uvlist.css \
  $(SRCDIR)/style.wikiedit.css \
  $(SRCDIR)/tree.js \
  $(SRCDIR)/useredit.js \
  $(SRCDIR)/wiki.wiki

TRANS_SRC = \
  $(OBJDIR)/add_.c \

Added src/style.uvlist.css.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
body.uvlist input {
  margin: 0.5em;
}

body.uvlist form {
  display: block;
}

Changes to src/unversioned.c.

518
519
520
521
522
523
524














































525
526
527
528
529
530
531
    }
    db_unset("uv-hash", 0);
    db_end_transaction(0);
  }else{
    usage("add|cat|edit|export|list|revert|remove|sync|touch");
  }
}















































/*
** WEBPAGE: uvlist
**
** Display a list of all unversioned files in the repository.
** Query parameters:
**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
    }
    db_unset("uv-hash", 0);
    db_end_transaction(0);
  }else{
    usage("add|cat|edit|export|list|revert|remove|sync|touch");
  }
}

/*
** Emit an HTML form for uploading a new unversioned file if
** the current user has WrUnver permissions, else this is
** a no-op.
**
** If this function detects that the form it emits has been submitted,
** it will add the uploaded file to the unversioned file list before
** returning.
**
** Intended only for use by /uvlist, and its form's action is that
** page.
*/
static void uvlist_upload(void){
  const char * aContent;
  if( !g.perm.WrUnver ) return;
  aContent = P("f");
  if( aContent!=0 ){
    const char * const zName = P("f:filename");
    int const nContent = atoi(PD("f:bytes","0"));
    const char * zError = 0;
    Blob content;
    if( zName[0]==0 ){
      zError = "be an empty string";
    }else if( contains_whitespace(zName) ){
      zError = "contain spaces";
    }
    if( zError ){
      fossil_fatal("Unversioned filenames may not %s: %Q",
                   zError, zName);
    }
    unversioned_schema();
    db_begin_transaction();
    content_rcvid_init("#!fossil /uvlist upload");
    blob_init(&content, aContent, nContent);
    unversioned_write(zName, &content, time(0));
    blob_reset(&content);
    db_end_transaction(0);
    CX("<div>Added: %s</div>", zName);
  }
  form_begin("enctype='multipart/form-data'", "%R/uvlist");
  CX("<label for='uvupload'>Upload unversioned file:</label>");
  CX("<input type='file' id='uvupload' name='f'/>");
  CX("<input type='submit' value='Upload'/>");
  CX("</form>");
}

/*
** WEBPAGE: uvlist
**
** Display a list of all unversioned files in the repository.
** Query parameters:
**
543
544
545
546
547
548
549

550
551
552
553
554
555
556
  char zSzName[100];

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
  cgi_check_for_malice();
  etag_check(ETAG_DATA,0);
  style_header("Unversioned Files");

  if( !db_table_exists("repository","unversioned") ){
    @ No unversioned files on this server
    style_finish_page();
    return;
  }
  if( PB("byage") ) zOrderBy = "mtime DESC";
  if( PB("showdel") ) showDel = 1;







>







589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
  char zSzName[100];

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
  cgi_check_for_malice();
  etag_check(ETAG_DATA,0);
  style_header("Unversioned Files");
  uvlist_upload();
  if( !db_table_exists("repository","unversioned") ){
    @ No unversioned files on this server
    style_finish_page();
    return;
  }
  if( PB("byage") ) zOrderBy = "mtime DESC";
  if( PB("showdel") ) showDel = 1;

Changes to win/Makefile.mingw.

655
656
657
658
659
660
661

662
663
664
665
666
667
668
  $(SRCDIR)/sounds/d.wav \
  $(SRCDIR)/sounds/e.wav \
  $(SRCDIR)/sounds/f.wav \
  $(SRCDIR)/style.admin_log.css \
  $(SRCDIR)/style.chat.css \
  $(SRCDIR)/style.fileedit.css \
  $(SRCDIR)/style.pikchrshow.css \

  $(SRCDIR)/style.wikiedit.css \
  $(SRCDIR)/tree.js \
  $(SRCDIR)/useredit.js \
  $(SRCDIR)/wiki.wiki

TRANS_SRC = \
  $(OBJDIR)/add_.c \







>







655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
  $(SRCDIR)/sounds/d.wav \
  $(SRCDIR)/sounds/e.wav \
  $(SRCDIR)/sounds/f.wav \
  $(SRCDIR)/style.admin_log.css \
  $(SRCDIR)/style.chat.css \
  $(SRCDIR)/style.fileedit.css \
  $(SRCDIR)/style.pikchrshow.css \
  $(SRCDIR)/style.uvlist.css \
  $(SRCDIR)/style.wikiedit.css \
  $(SRCDIR)/tree.js \
  $(SRCDIR)/useredit.js \
  $(SRCDIR)/wiki.wiki

TRANS_SRC = \
  $(OBJDIR)/add_.c \

Changes to win/Makefile.msc.

613
614
615
616
617
618
619

620
621
622
623
624
625
626
        "$(SRCDIR)\sounds\d.wav" \
        "$(SRCDIR)\sounds\e.wav" \
        "$(SRCDIR)\sounds\f.wav" \
        "$(SRCDIR)\style.admin_log.css" \
        "$(SRCDIR)\style.chat.css" \
        "$(SRCDIR)\style.fileedit.css" \
        "$(SRCDIR)\style.pikchrshow.css" \

        "$(SRCDIR)\style.wikiedit.css" \
        "$(SRCDIR)\tree.js" \
        "$(SRCDIR)\useredit.js" \
        "$(SRCDIR)\wiki.wiki"

OBJ   = "$(OX)\add$O" \
        "$(OX)\ajax$O" \







>







613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
        "$(SRCDIR)\sounds\d.wav" \
        "$(SRCDIR)\sounds\e.wav" \
        "$(SRCDIR)\sounds\f.wav" \
        "$(SRCDIR)\style.admin_log.css" \
        "$(SRCDIR)\style.chat.css" \
        "$(SRCDIR)\style.fileedit.css" \
        "$(SRCDIR)\style.pikchrshow.css" \
        "$(SRCDIR)\style.uvlist.css" \
        "$(SRCDIR)\style.wikiedit.css" \
        "$(SRCDIR)\tree.js" \
        "$(SRCDIR)\useredit.js" \
        "$(SRCDIR)\wiki.wiki"

OBJ   = "$(OX)\add$O" \
        "$(OX)\ajax$O" \
1242
1243
1244
1245
1246
1247
1248

1249
1250
1251
1252
1253
1254
1255
	echo "$(SRCDIR)\sounds/d.wav" >> $@
	echo "$(SRCDIR)\sounds/e.wav" >> $@
	echo "$(SRCDIR)\sounds/f.wav" >> $@
	echo "$(SRCDIR)\style.admin_log.css" >> $@
	echo "$(SRCDIR)\style.chat.css" >> $@
	echo "$(SRCDIR)\style.fileedit.css" >> $@
	echo "$(SRCDIR)\style.pikchrshow.css" >> $@

	echo "$(SRCDIR)\style.wikiedit.css" >> $@
	echo "$(SRCDIR)\tree.js" >> $@
	echo "$(SRCDIR)\useredit.js" >> $@
	echo "$(SRCDIR)\wiki.wiki" >> $@

"$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h"
	$(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c"







>







1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
	echo "$(SRCDIR)\sounds/d.wav" >> $@
	echo "$(SRCDIR)\sounds/e.wav" >> $@
	echo "$(SRCDIR)\sounds/f.wav" >> $@
	echo "$(SRCDIR)\style.admin_log.css" >> $@
	echo "$(SRCDIR)\style.chat.css" >> $@
	echo "$(SRCDIR)\style.fileedit.css" >> $@
	echo "$(SRCDIR)\style.pikchrshow.css" >> $@
	echo "$(SRCDIR)\style.uvlist.css" >> $@
	echo "$(SRCDIR)\style.wikiedit.css" >> $@
	echo "$(SRCDIR)\tree.js" >> $@
	echo "$(SRCDIR)\useredit.js" >> $@
	echo "$(SRCDIR)\wiki.wiki" >> $@

"$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h"
	$(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c"

Changes to www/changes.wiki.

9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
     preferred case rather than the case typed in by the user.
  *  Change the name "fossil cherry-pick" command to "fossil cherrypick",
     which is more familiar to Git users.  Retain the legacy name for
     compatibility.
  *  Add new query parameters to the [/help?cmd=/timeline|/timeline page]:
     d2=, p2=, and dp2=.
  *  Add options to the [/help?cmd=tag|fossil tag] command that will list tag values

     

<h2 id='v2_24'>Changes for version 2.24 (2024-04-23)</h2>

  *  Apache change work-around &rarr; As part of a security fix, the Apache webserver
     mod_cgi module has stopped relaying the Content-Length field of the HTTP
     reply header from the CGI programs back to the client in cases where the
     connection is to be closed and the client is able to read until end-of-file.







>
|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
     preferred case rather than the case typed in by the user.
  *  Change the name "fossil cherry-pick" command to "fossil cherrypick",
     which is more familiar to Git users.  Retain the legacy name for
     compatibility.
  *  Add new query parameters to the [/help?cmd=/timeline|/timeline page]:
     d2=, p2=, and dp2=.
  *  Add options to the [/help?cmd=tag|fossil tag] command that will list tag values
  *  Add ability to upload unversioned files via the [/help?cmd=/uvlist|/uvlist page].


<h2 id='v2_24'>Changes for version 2.24 (2024-04-23)</h2>

  *  Apache change work-around &rarr; As part of a security fix, the Apache webserver
     mod_cgi module has stopped relaying the Content-Length field of the HTTP
     reply header from the CGI programs back to the client in cases where the
     connection is to be closed and the client is able to read until end-of-file.