You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/06 15:42:07 UTC

[GitHub] [superset] eschutho opened a new pull request, #19569: fix: ensure url is a string

eschutho opened a new pull request, #19569:
URL: https://github.com/apache/superset/pull/19569

   ### SUMMARY
   This small change ensures that a uri is a string before performing the `strip` method on it.
   
   ### TESTING INSTRUCTIONS
   automated tests to check that the make_url_safe function can take both a string or a `Url`
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho merged pull request #19569: fix: check type of url before performing string actions

Posted by GitBox <gi...@apache.org>.
eschutho merged PR #19569:
URL: https://github.com/apache/superset/pull/19569


-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on a diff in pull request #19569: fix: ensure url is a string

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #19569:
URL: https://github.com/apache/superset/pull/19569#discussion_r844329528


##########
superset/databases/utils.py:
##########
@@ -112,7 +112,9 @@ def make_url_safe(raw_url: str) -> URL:
     :param raw_url:
     :return:
     """
+
+    url = str(raw_url).strip()

Review Comment:
   Yeah, that's tricky. I found that sometimes we're passing in `Url` because this method has already previously been run on a uri before it was passed in here, but it would technically be better if this function were passed in a string. But since the typing is just a hint, we still need to provide our own guards against incorrect types. Do you think adding `Url` to the typing is still helpful or maybe a comment here?



-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on a diff in pull request #19569: fix: ensure url is a string

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #19569:
URL: https://github.com/apache/superset/pull/19569#discussion_r844339479


##########
superset/databases/utils.py:
##########
@@ -112,7 +112,9 @@ def make_url_safe(raw_url: str) -> URL:
     :param raw_url:
     :return:
     """
+
+    url = str(raw_url).strip()

Review Comment:
   Actually now that I look at the function parameter types for the original make_url, it can take a URL and then just returns the same URL. Good catch. I think I'll do the same here.



##########
superset/databases/utils.py:
##########
@@ -112,7 +112,9 @@ def make_url_safe(raw_url: str) -> URL:
     :param raw_url:
     :return:
     """
+
+    url = str(raw_url).strip()

Review Comment:
   Actually now that I look at the function parameter types for the original make_url, it can take a URL and then just returns the same URL. Good call. I think I'll do the same here.



-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #19569: fix: ensure url is a string

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #19569:
URL: https://github.com/apache/superset/pull/19569#issuecomment-1090431843

   # [Codecov](https://codecov.io/gh/apache/superset/pull/19569?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19569](https://codecov.io/gh/apache/superset/pull/19569?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c532fd4) into [master](https://codecov.io/gh/apache/superset/commit/1b4d8ddf7103f3fa18683a0f23dff6d532ad7efa?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1b4d8dd) will **decrease** coverage by `12.65%`.
   > The diff coverage is `63.88%`.
   
   > :exclamation: Current head c532fd4 differs from pull request most recent head 117d113. Consider uploading reports for the commit 117d113 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #19569       +/-   ##
   ===========================================
   - Coverage   66.59%   53.94%   -12.66%     
   ===========================================
     Files        1682     1678        -4     
     Lines       64314    64262       -52     
     Branches     6559     6561        +2     
   ===========================================
   - Hits        42832    34666     -8166     
   - Misses      19781    27895     +8114     
     Partials     1701     1701               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.71% <100.00%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.56% <100.00%> (+<0.01%)` | :arrow_up: |
   | python | `56.51% <100.00%> (-25.88%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `47.21% <100.00%> (+<0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19569?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...et-ui-chart-controls/src/shared-controls/index.tsx](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL3NoYXJlZC1jb250cm9scy9pbmRleC50c3g=) | `36.19% <ø> (ø)` | |
   | [.../legacy-plugin-chart-country-map/src/CountryMap.js](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LWNvdW50cnktbWFwL3NyYy9Db3VudHJ5TWFwLmpz) | `0.00% <ø> (ø)` | |
   | [.../legacy-plugin-chart-sankey-loop/src/SankeyLoop.js](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LXNhbmtleS1sb29wL3NyYy9TYW5rZXlMb29wLmpz) | `0.00% <ø> (ø)` | |
   | [...-chart-deckgl/src/layers/Screengrid/Screengrid.jsx](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvbGF5ZXJzL1NjcmVlbmdyaWQvU2NyZWVuZ3JpZC5qc3g=) | `0.00% <ø> (ø)` | |
   | [...lugin-chart-echarts/src/BigNumber/BigNumberViz.tsx](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvQmlnTnVtYmVyL0JpZ051bWJlclZpei50c3g=) | `0.00% <0.00%> (ø)` | |
   | [...src/BigNumber/BigNumberWithTrendline/buildQuery.ts](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvQmlnTnVtYmVyL0JpZ051bWJlcldpdGhUcmVuZGxpbmUvYnVpbGRRdWVyeS50cw==) | `11.11% <ø> (ø)` | |
   | [.../BigNumber/BigNumberWithTrendline/controlPanel.tsx](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvQmlnTnVtYmVyL0JpZ051bWJlcldpdGhUcmVuZGxpbmUvY29udHJvbFBhbmVsLnRzeA==) | `33.33% <ø> (ø)` | |
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `60.73% <0.00%> (ø)` | |
   | [...rontend/src/SqlLab/components/QueryTable/index.tsx](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1F1ZXJ5VGFibGUvaW5kZXgudHN4) | `68.96% <ø> (ø)` | |
   | [...-frontend/src/components/AlteredSliceTag/index.jsx](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQWx0ZXJlZFNsaWNlVGFnL2luZGV4LmpzeA==) | `87.87% <ø> (ø)` | |
   | ... and [292 more](https://codecov.io/gh/apache/superset/pull/19569/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19569?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19569?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [1b4d8dd...117d113](https://codecov.io/gh/apache/superset/pull/19569?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] etr2460 commented on a diff in pull request #19569: fix: ensure url is a string

Posted by GitBox <gi...@apache.org>.
etr2460 commented on code in PR #19569:
URL: https://github.com/apache/superset/pull/19569#discussion_r844163771


##########
superset/databases/utils.py:
##########
@@ -112,7 +112,9 @@ def make_url_safe(raw_url: str) -> URL:
     :param raw_url:
     :return:
     """
+
+    url = str(raw_url).strip()

Review Comment:
   if `url` might not be a string, can you fix the typing of the function?



-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] etr2460 commented on a diff in pull request #19569: fix: ensure url is a string

Posted by GitBox <gi...@apache.org>.
etr2460 commented on code in PR #19569:
URL: https://github.com/apache/superset/pull/19569#discussion_r844347290


##########
superset/databases/utils.py:
##########
@@ -112,7 +112,9 @@ def make_url_safe(raw_url: str) -> URL:
     :param raw_url:
     :return:
     """
+
+    url = str(raw_url).strip()

Review Comment:
   Thanks for making the change. We definitely want the type hints to match the actual types passed in. mypy should ideally catch this when type checking too, i'm wondering why that wasn't the case



-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sadpandajoe commented on pull request #19569: fix: check type of url before performing string actions

Posted by GitBox <gi...@apache.org>.
sadpandajoe commented on PR #19569:
URL: https://github.com/apache/superset/pull/19569#issuecomment-1091918674

   🏷️ preset:2022.11


-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org