Comments (10)
@sherwinski thanks for the return! Understood the idea, and I'll try to work on this when I can
from js-core.
can I try to work on this one?
from js-core.
@FilipePfluck Yes please go for it! I'll mark this issue as assigned to you.
In terms of next steps, please either comment here or open a RFC (request for comment) draft PR explaining the change you'd like to implement.
You can also take a look at our contributing guidelines to get you started.
If you have any trouble at all getting setup or have any questions, don't hesitate to comment here and tag a team member.
from js-core.
@sherwinski I have a question, I've forked and cloned the repo, and I'm checking out the code right now. But how do I run it, to test what I'm making?
from js-core.
Hey @FilipePfluck,
Best recommendation I have is to create tests in either the pathEncoding or buildURL test files and run npm run test
to run them.
If you haven't already, please take a moment to read through our contributing docs which will walk you through suggested steps to take when opening a PR.
Please let me know if you have any other questions I can help with.
from js-core.
It seems like the encodeURIComponent()
doesn't encode some characters such as -_.!~*'()
. I don't know if I'm understanding it correctly, but I think they're not suposed to be encoded at all.
@sherwinski can you explain to me why do we need to encode the ' character (and perhaps the others I listed above?). If we really need to encode them, I can work on something to encode them aswell.
from js-core.
@FilipePfluck good question, let me circle back with the team that originally reported this issue and I'll get back to you.
from js-core.
Hey @FilipePfluck and thanks for your patience on this.
After discussing it with the team, we’ve agreed that the best solution for this would be to extend the buildURL
and buildSrcSet
functions to accept a custom encoder, which allows users to specify their own desired encoding scheme.
The best place to add this would most likely be in the options parameter in each function signature:
const ImgixClient = require("@imgix/js-core");
const client = new ImgixClient({
domain: 'test.imgix.com',
secureURLToken: 'xxxxxxxx',
});
client.buildURL(
"https://imgix-proxy.n8s.jp/img_nikkei-sum.jpg",
{
"txt": "test!()*"
},
{
encode: (path) => encodeURI(path).replace("'", "%27")
}
)
The specified function should be passed down to _sanitizePath
and _buildParams
, otherwise encoding should just default to encodeURIComponent
as it currently does. This should allow users to have more freedom in specifying how URLs get encoded, rather than trying to adjust this library's default behavior to account for every edge case.
from js-core.
I'm going to re-open this since we should probably allow for Base64 parameters to not get re-encoded when custom encoder()
fn is provided.
Lines 122 to 125 in 02fab15
Open to PRs, otherwise, we'll tackle this at some point next year.
from js-core.
Resolved by #350
from js-core.
Related Issues (20)
- Encrypting the origin URL HOT 5
- `buildSrcSet` mutates `params` argument when building either fluid or fixed-width srcset. HOT 2
- A fluid-width srcset is generated when a height is passed HOT 13
- Image has distored boarder when used in <meta></meta> tag HOT 1
- Expires params? HOT 2
- Action Required: Fix Renovate Configuration
- Dependency Dashboard
- Allow different Quality presets for buildSrcSet HOT 3
- Allow configure srcSet DPR generation HOT 3
- Relax js-base64 constraint to `^3.6` HOT 2
- Typescript types for `params` HOT 3
- Do you support Management APIs? HOT 3
- Could you also allow localhost:${port} in DOMAIN_REGEX? HOT 5
- Latest @imgix/js-core does not work with Nuxt 3 HOT 4
- host is depracated but... HOT 4
- Ability to define success/failure/processing handlers HOT 1
- Typings HOT 10
- Typescript and `@types/node` should be devDependencies. HOT 2
- Plus-sign in S3 key causes 404 HOT 3
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 js-core.