Comments (4)
Confirmed in Google Chrome 76 and Mozilla Firefox 69.0:
const URL_LONG = /^(((http[s]?)|file):)?(\/\/)+([0-9a-zA-Z-_.=?&].+)$/g
const URL_SHORT = /^([\.]?\/)([0-9a-zA-Z-_.=?&]+\/)*([0-9a-zA-Z-_.=?&]+)$/g
const isValidURL = (str) => (URL_LONG.test(str) || URL_SHORT.test(str))
// undefined
isValidURL("https://.../css/chunk-04aba45e.8c018d83.css")
// true
isValidURL("https://.../css/chunk-019a112c.78b8d35d.css")
// false
URL_LONG.test("https://.../css/chunk-019a112c.78b8d35d.css")
// true
from printd.
Using arrow function isValidURL()
together with the two RegExs is returning a wrong result.
But it works using a conventional anonymous function.
Tested in Google Chrome 76 and Mozilla Firefox 69.0:
const isValidURL2 = function (str: string) {
return (URL_LONG.test(str) || URL_SHORT.test(str))
}
// undefined
isValidURL2("https://.../css/chunk-019a112c.78b8d35d.css")
// true
isValidURL2("https://.../css/chunk-04aba45e.8c018d83.css")
// true
from printd.
This is very weird behaviour. I'm going to prepare a bugfix commit for this.
from printd.
Fixed in new release v1.4.1
from printd.
Related Issues (19)
- Print chartjs HOT 1
- Error on several pages HOT 1
- Printd event `beforeprint` and `afterprint` not work HOT 2
- Cannot create Printd instance passing options object. HOT 1
- Headers and Footer HOT 2
- Pass Authentication Headers via printURL. HOT 1
- Change title HOT 2
- Broken in IE11 HOT 5
- Insert page # in footer HOT 4
- Print selected value in select tag html HOT 2
- Using css file HOT 4
- Background colors do not show up HOT 1
- Print a vue route with params HOT 4
- Not showing the browser's print window when printing an URL HOT 18
- Fix demo printing currently selected options HOT 1
- Printd event `afterprint` not work on Chrome HOT 3
- printURL does not work? HOT 4
- how to add tailwingcss? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from printd.