MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / getFileLink

Function getFileLink

frontend/src/hooks/useFileManager.ts:866–886  ·  view source on GitHub ↗
(fileName: string, frontDir?: string)

Source from the content-addressed store, hash-verified

864 };
865
866 const getFileLink = async (fileName: string, frontDir?: string) => {
867 frontDir = frontDir || currentPath.value;
868 const { state: downloadCfg, execute: getDownloadCfg } = downloadAddress();
869
870 try {
871 await getDownloadCfg({
872 params: {
873 file_name: frontDir + fileName,
874 daemonId: daemonId || "",
875 uuid: instanceId || ""
876 }
877 });
878 if (!downloadCfg.value) return null;
879 const addr = parseForwardAddress(getFileConfigAddr(downloadCfg.value), "http");
880 const path = `/download/${downloadCfg.value.password}/${fileName}`;
881 return addr + path;
882 } catch (err: any) {
883 console.error(err);
884 return reportErrorMsg(err.message);
885 }
886 };
887
888 const downloadFromUrl = async (downloadConfig: DownloadFileConfigItem) => {
889 if (!downloadConfig.url) throw new Error(t("TXT_CODE_f3031262"));

Callers 1

downloadFileFunction · 0.85

Calls 4

parseForwardAddressFunction · 0.90
reportErrorMsgFunction · 0.90
getFileConfigAddrFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected