diff --git a/go.mod b/go.mod index 38d2a80..a91b678 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23.3 require ( git.ailur.dev/ailur/fg-library/v3 v3.6.2 - git.ailur.dev/ailur/fg-nucleus-library v1.1.2 + git.ailur.dev/ailur/fg-nucleus-library v1.2.1 git.ailur.dev/ailur/pow v1.0.3 github.com/CAFxX/httpcompression v0.0.9 github.com/cespare/xxhash/v2 v2.3.0 diff --git a/go.sum b/go.sum index d6f05b3..c6c44e5 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,9 @@ git.ailur.dev/ailur/fg-nucleus-library v1.1.1 h1:IRpAQqgikeT2FyhVbhe16GyIxuTsf1X git.ailur.dev/ailur/fg-nucleus-library v1.1.1/go.mod h1:stxiTyMv3Fa7GzpyLbBUh3ahlb7110p0NnCl8ZTjwBs= git.ailur.dev/ailur/fg-nucleus-library v1.1.2 h1:MXn0BorA8TV46Ig+4C96RU0NpFqrsGNbuw2QCc/7K6Q= git.ailur.dev/ailur/fg-nucleus-library v1.1.2/go.mod h1:stxiTyMv3Fa7GzpyLbBUh3ahlb7110p0NnCl8ZTjwBs= +git.ailur.dev/ailur/fg-nucleus-library v1.2.0/go.mod h1:stxiTyMv3Fa7GzpyLbBUh3ahlb7110p0NnCl8ZTjwBs= +git.ailur.dev/ailur/fg-nucleus-library v1.2.1 h1:7Vs0q6KyIvAWDMkOvgOcbj/WKpubYKZUszhByKIF+/I= +git.ailur.dev/ailur/fg-nucleus-library v1.2.1/go.mod h1:stxiTyMv3Fa7GzpyLbBUh3ahlb7110p0NnCl8ZTjwBs= git.ailur.dev/ailur/pow v1.0.3 h1:LjLSol4ax+M+SoajVjbBoDjfmjH6pKu3fDka7bl2KGY= git.ailur.dev/ailur/pow v1.0.3/go.mod h1:ClAmIdHQ/N9wTq5S4YWhQ5d9CPUBcEjVuOkT07zBdJ4= github.com/CAFxX/httpcompression v0.0.9 h1:0ue2X8dOLEpxTm8tt+OdHcgA+gbDge0OqFQWGKSqgrg= diff --git a/services-src/storage/main.go b/services-src/storage/main.go index 7259e2c..81a6cc2 100644 --- a/services-src/storage/main.go +++ b/services-src/storage/main.go @@ -3,6 +3,7 @@ package main import ( library "git.ailur.dev/ailur/fg-library/v3" nucleusLibrary "git.ailur.dev/ailur/fg-nucleus-library" + "io" "bytes" "os" @@ -193,7 +194,7 @@ func modifyFile(information *library.ServiceInitializationInformation, message l if err != nil { respondError(message, err, information, true) } - if used+int64(len(message.Message.(nucleusLibrary.File).Bytes)) > quota { + if used+message.Message.(nucleusLibrary.File).Reader.N > quota { respondError(message, errors.New("insufficient storage"), information, false) return } @@ -205,7 +206,7 @@ func modifyFile(information *library.ServiceInitializationInformation, message l } // Write the file - _, err = file.Write(message.Message.(nucleusLibrary.File).Bytes) + _, err = io.Copy(file, message.Message.(nucleusLibrary.File).Reader) if err != nil { respondError(message, err, information, true) }