Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394975 )

Change subject: Throw error if content to translate is not provided or empty
......................................................................

Throw error if content to translate is not provided or empty

This was hiding the error for the issue T173801

Bug: T173801
Change-Id: I2a75d4f04469d4c32e2b2dbdc5e5c9cbb41aace2
---
M lib/routes/v1.js
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/75/394975/1

diff --git a/lib/routes/v1.js b/lib/routes/v1.js
index 2652f4a..df4d5ef 100644
--- a/lib/routes/v1.js
+++ b/lib/routes/v1.js
@@ -181,6 +181,10 @@
                // We support setting html as body or as body.html. But 
body.html is the recommended way.
                // The other way will be removed soon.
                sourceHtml = req.body.html || req.rawBody;
+               if ( !sourceHtml || sourceHtml.length === 0 ) {
+                       res.status( 500 ).end( 'Content to translate is not 
given or empty' );
+                       return;
+               }
                return mtClient.translate( from, to, sourceHtml ).then(
                        ( data ) => {
                                res.json( {

-- 
To view, visit https://gerrit.wikimedia.org/r/394975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a75d4f04469d4c32e2b2dbdc5e5c9cbb41aace2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to