This commit is contained in:
yumoqing 2025-09-18 17:17:34 +08:00
parent aeb139acc8
commit 1013884a4c

View File

@ -9,6 +9,7 @@ import json
import time import time
from appPublic.folderUtils import _mkdir from appPublic.folderUtils import _mkdir
from appPublic.base64_to_file import base64_to_file, getFilenameFromBase64
from appPublic.jsonConfig import getConfig from appPublic.jsonConfig import getConfig
from appPublic.Singleton import SingletonDecorator from appPublic.Singleton import SingletonDecorator
from appPublic.log import info, debug, warning, exception, critical from appPublic.log import info, debug, warning, exception, critical
@ -88,6 +89,12 @@ class FileStorage:
p = os.path.abspath(os.path.join(self.root,path)) p = os.path.abspath(os.path.join(self.root,path))
return p return p
def save_base64_file(self, b64str):
filename = getFilenameFromBase64(b64str)
rfp = self._name2path(filename)
base64_to_file(b64str, rfp)
return rfp
def webpath(self, path): def webpath(self, path):
if path.startswith(self.root): if path.startswith(self.root):
return path[len(self.root):] return path[len(self.root):]