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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to