Skip to content

SAN-3947 - Set file size limits #1561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function fileEditor(
debounce,
errs,
keypather,
hasKeypaths,
modelist,
promisify,
loadingPromises
Expand Down Expand Up @@ -61,7 +60,11 @@ function fileEditor(
return promisify($scope.file, 'fetch')()
.then(resetFileBodyState)
.catch(function (error) {
$scope.hasError = 'failure';
if (keypather.get(error, 'data.res.statusCode') === 413) {
$scope.hasError = 'tooLarge';
} else {
$scope.hasError = 'failure';
}
errs.report(error);
})
.finally(function () {
Expand Down
5 changes: 5 additions & 0 deletions client/directives/activePanel/tabs/editor/viewFileEditor.jade
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
)
p.p We're Sorry, but your file is in another castle… and that castle just blew up! 😱

.blank-panel(
ng-if = "!loading && hasError === 'tooLarge'"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to reuse the existing .blank-panel element and replace the text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we did that'd result in having 3 ng-if's because we only want blank-panel to show if there is an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's a matter of preference, would you prefer I did that? @runnabro

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that !loading && hasError might cover it. I just thought it would be simpler. Do what you think is simpler.

p.p The requested file is too large to load.

.pre(
lazy-load = "ui.ace"
ng-if = "!hasError && file.attrs.fileType !== 'ssh'"
Expand Down