You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "mfatemipour (via GitHub)" <gi...@apache.org> on 2024/10/22 08:44:48 UTC

[I] Operator's extra link button is disabled [airflow]

mfatemipour opened a new issue, #43252:
URL: https://github.com/apache/airflow/issues/43252

   ### Apache Airflow version
   
   2.10.2
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.10.2
   
   ### What happened?
   
   When in get_link method I provide `None`, the button is **enabled** and when I provide link (internal link) it is **disabled** 
   
   ### What you think should happen instead?
   
   in following code, if url is empty or None, the result of isSanitised is true ! 
   also if the url is internal then isSanitised is true (so internal url is not supported)
   
   As a workaround for now I am providing a random non-rul string instead of None, and I replaced my internal url with absolute one (but I missed rendering my page in same window now)
   
   ``` py
   const isExternal = (url: string | null) =>
       url && /^(?:[a-z]+:)?\/\//.test(url);
   
     const isSanitised = (url: string | null) => {
       if (!url) {
         return true;
       }
       const urlRegex = /^(https?:)/i;
       return urlRegex.test(url);
     };
   
     return (
       <Box my={3}>
         <Text as="strong">Extra Links</Text>
         <Flex flexWrap="wrap" mt={3}>
           {links.map(({ name, url }) => (
             <Button
               key={name}
               as={Link}
               colorScheme="blue"
               href={url}
               isDisabled={!isSanitised(url)}
               target={isExternal(url) ? "_blank" : undefined}
               mr={2}
             >
               {name}
             </Button>
           ))}
         </Flex>
         <Divider my={2} />
       </Box>
     );
   };
   ```
   
   
   ### How to reproduce
   
   - Create a simple plugin with an OperatorLink
   - Return None in get_link() method of your OperatorLink
   - You can see the button in Details page of corresponding task is enalbed.
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   non related
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   We are deploying on docker swarm
   
   ### Anything else?
   
   It works in 2.8.1 
   And It seems that internal url issue is fixed in **main** branch but None handling is not fixed.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-3889086384

   This issue has been closed because it has not received response from the issue author.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "enisnazif (via GitHub)" <gi...@apache.org>.
enisnazif commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2466179205

   I'm happy to investigate this - will take a look now 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2466698109

   Fixed in https://github.com/apache/airflow/pull/43844


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "mfatemipour (via GitHub)" <gi...@apache.org>.
mfatemipour commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2497432445

   Hi, Your fix isn't complete, as I mentioned in my previous command isSanitised should returns `true` also for internal urls. but now it returns `false`
   
   ```
   const urlRegex = /^(https?:)/i;
   return urlRegex.test(url);
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #43252: Operator's extra link button is disabled
URL: https://github.com/apache/airflow/issues/43252


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-3742370349

   This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "enisnazif (via GitHub)" <gi...@apache.org>.
enisnazif commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2466229721

   candidate PR here: https://github.com/apache/airflow/pull/43844


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2505182933

   > const urlRegex = /^(https?:)/i;
   
   Can you propose a better fix ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "aditya0yadav (via GitHub)" <gi...@apache.org>.
aditya0yadav commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2585844906

   If it is available, can I work on this


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "enisnazif (via GitHub)" <gi...@apache.org>.
enisnazif commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2466222685

   If I understand you correctly, seems like this can be solved with:
   
   ```
   const isSanitised = (url: string | null) => {
       if (!url) {
         return false;
       }
       const urlRegex = /^(https?:)/i;
       return urlRegex.test(url);
     };
   ```
   
   i.e, if the URL is '' or null, set isSanitised to false 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "mfatemipour (via GitHub)" <gi...@apache.org>.
mfatemipour commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2466661922

   isSanitised should return `true` for internal urls too.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "mfatemipour (via GitHub)" <gi...@apache.org>.
mfatemipour commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2505489554

   Yeah, first of all, following code to check that a url is external is buggy:
   ```
   const isExternal = (url: string | null) =>
       url && /^(?:[a-z]+:)?\/\//.test(url);
   ```
   
   This regex will accept a url starting with "//"
   
   so first let's fix this (removing `?`):
   ```
   const isExternal = (url: string | null) =>
       url && /^(?:[a-z]+:)\/\//.test(url);
   ```
   
   And for the isSantised method let's reuse this isExternal
   to check that if url is external or internal (for internal check, starts with a single `/` character)
   
   ```
   const isSanitised = (url: string | null) => {
       if (!url) {
         return true;
       }
       return isExternal(url) || /^\/[^\/]/.test(url);
     };
   ```
   
   I cannot test it, I don't have a ready airflow dev environment on my business machine, otherwise I would be appreciated to contribute.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Operator's extra link button is disabled [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #43252:
URL: https://github.com/apache/airflow/issues/43252#issuecomment-2506032276

   > I cannot test it, I don't have a ready airflow dev environment on my work laptop, otherwise I would be appreciated to contribute.
   
   
   You can use codespaces - which is entirely from the browser, supported by Airflow and free up to 80 hours a month for everyone in GitHub. Super easy to use - you click a button and you have working development environment with airflow in a matter of minutes. Quick start here: https://github.com/apache/airflow/blob/main/contributing-docs/quick-start-ide/contributors_quick_start_codespaces.rst
   
   If you can create and coment on issues in GitHub, you can also run this development environment -as it is purely in-browser and runs Airflow's CI image remotely on GitHub's workers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org