Skip to content

Commit

Permalink
refactor upload repo size limitation (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlaoaa authored Oct 29, 2023
1 parent 863f93b commit e282a36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions solidportal/panel/src/components/UserInputView.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const UserInputView = ({ showView,
const [userRequirement, setUserRequirement] = useState("");
const [productInfo, setProductInfo] = useState("");
const pollingInterval = 5000;
const UploadFilesSizeLimit = 10485760 * 5;
const [uploadStatus, setUploadStatus] = useState(false)

const disableStart = useRef(true)
Expand Down Expand Up @@ -116,14 +115,14 @@ const UserInputView = ({ showView,
const files = event.target;
let totalSize = 0;
for (let i = 0; i < files.files.length; i++) {
if (totalSize > UploadFilesSizeLimit) {
if (totalSize > config.UploadFilesSizeLimit) {
alert(stringConstant.FileSizeAlert);
repoRootFolderRef.current = null
return
}
totalSize = totalSize + files.files[i].size
}
if (totalSize < UploadFilesSizeLimit) {
if (totalSize < config.UploadFilesSizeLimit) {
setRepoRootFolder(files);
repoRootFolderRef.current = files
} else {
Expand Down
3 changes: 2 additions & 1 deletion solidportal/panel/src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const config = {
CurrentGraphId: "CURRENT_GRAPH_ID",
CustomHeaders: {
'Content-Type': 'application/json', // Set the appropriate content type
}
},
UploadFilesSizeLimit: 1024 * 1024 * 50 //50MB
};

export default config;

0 comments on commit e282a36

Please sign in to comment.