diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js
index 8cd5cf439d73d3209a3bfa9609ad222ed6b74117..d7f55b6f6380529dbcda22a1f148e9bb259fba9f 100644
--- a/packages/react-scripts/config/paths.js
+++ b/packages/react-scripts/config/paths.js
@@ -23,7 +23,7 @@ const envPublicUrl = process.env.PUBLIC_URL;
 function ensureSlash(path, needsSlash) {
   const hasSlash = path.endsWith('/');
   if (hasSlash && !needsSlash) {
-    return path.substr(path, path.length - 1);
+    return path.substr(0, path.length - 1);
   } else if (!hasSlash && needsSlash) {
     return `${path}/`;
   } else {