1- use super :: FileType ;
21use super :: {
3- upload_request_headers, File , FileCleanupCandidate , FilePolicy , FileUpload , FileUploadResponse ,
4- NewFile , NewFileUpload ,
2+ upload_request_headers, ChecksumAlgorithm , File , FileCleanupCandidate , FilePolicy , FileType ,
3+ FileUpload , FileUploadResponse , NewFile , NewFileUpload ,
54} ;
65use crate :: db:: PgPool ;
76use crate :: model:: {
@@ -724,7 +723,7 @@ impl FileUpload {
724723 ctx : & C ,
725724 work : & Work ,
726725 cdn_url : & str ,
727- cdn_checksum : & str ,
726+ cdn_sha256 : & str ,
728727 featured_video_dimensions : Option < ( i32 , i32 ) > ,
729728 ) -> ThothResult < ( ) > {
730729 match self . file_type {
@@ -742,7 +741,7 @@ impl FileUpload {
742741 publication_id,
743742 work. landing_page . clone ( ) ,
744743 cdn_url,
745- Some ( cdn_checksum . to_string ( ) ) ,
744+ Some ( cdn_sha256 . to_string ( ) ) ,
746745 ) ?;
747746 }
748747 FileType :: AdditionalResource => {
@@ -794,7 +793,7 @@ impl FileUpload {
794793 publication_id : Uuid ,
795794 landing_page : Option < String > ,
796795 full_text_url : & str ,
797- checksum : Option < String > ,
796+ sha256 : Option < String > ,
798797 ) -> ThothResult < ( ) > {
799798 use crate :: schema:: location:: dsl;
800799
@@ -812,7 +811,8 @@ impl FileUpload {
812811 patch. full_text_url = Some ( full_text_url. to_string ( ) ) ;
813812 patch. landing_page = landing_page;
814813 patch. canonical = true ;
815- patch. checksum = checksum;
814+ patch. checksum = sha256;
815+ patch. checksum_algorithm = Some ( ChecksumAlgorithm :: Sha256 ) ;
816816 if patch. canonical {
817817 patch. canonical_record_complete ( ctx. db ( ) ) ?;
818818 }
@@ -834,7 +834,8 @@ impl FileUpload {
834834 full_text_url : Some ( full_text_url. to_string ( ) ) ,
835835 location_platform : LocationPlatform :: Thoth ,
836836 canonical : false ,
837- checksum,
837+ checksum : sha256,
838+ checksum_algorithm : Some ( ChecksumAlgorithm :: Sha256 ) ,
838839 } ;
839840 let created_location = Location :: create ( ctx. db ( ) , & new_location) ?;
840841 let mut patch = PatchLocation :: from ( created_location. clone ( ) ) ;
@@ -850,7 +851,8 @@ impl FileUpload {
850851 full_text_url : Some ( full_text_url. to_string ( ) ) ,
851852 location_platform : LocationPlatform :: Thoth ,
852853 canonical : true ,
853- checksum,
854+ checksum : sha256,
855+ checksum_algorithm : Some ( ChecksumAlgorithm :: Sha256 ) ,
854856 } ;
855857 new_location. canonical_record_complete ( ctx. db ( ) ) ?;
856858 Location :: create ( ctx. db ( ) , & new_location) ?;
0 commit comments