-
-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Set default port for Mattermost notifications #1293
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1293 +/- ##
=======================================
Coverage 99.36% 99.36%
=======================================
Files 159 159
Lines 20724 20730 +6
Branches 3725 3728 +3
=======================================
+ Hits 20593 20599 +6
Misses 121 121
Partials 10 10 ☔ View full report in Codecov by Sentry. |
This change is no required; i'm not sure why you would want to force a port when it is already known. Why would you want to exclusively set the port. This would especially break some SSL issues if there are keys involved and a request is made to |
The trouble is that the original code does not parse results of Shouldn't result of
The trouble is Port gets parsed to "None". So then, continuing the description if we try to actually send the notification we get:
With the patch it becomes It's possible the bug/fix is elsewhere though. Would appreciate pointers where/how to fix the |
Ah, perhaps the fix is in: apprise/apprise/plugins/mattermost.py Lines 218 to 220 in ece4920
Basically - don't include the port in URL if it matches default. Would that be preferred fix from your end I suppose? |
c7db81e
to
22034a1
Compare
@caronc Adjusted the PR using the other approach. Forgot to mention! Thanks for quick feedback/review. Much appreciated |
When we generate a MM notification URL with default port: >>> NotifyMattermost(token="secret", host="chat.example.com", port=443, secure=True).url() 'mmosts://chat.example.com/secret/?image=no&format=text&overflow=upstream' And then try to send it: ``` ac=Apprise() ac.add(NotifyMattermost(token="secret", host="chat.example.com", port=443, secure=True).url()) ac.notify("testing") ``` It fails. In debug logs we can see: `DEBUG:apprise:Mattermost POST URL: https://chat.example.com:None/hooks/secret (cert_verify=True)` Port is always included in the POST url, but if port matches default value for given "secret" we might not have it defined. So let's only include port in Mattermost URL if not None
22034a1
to
786f8a8
Compare
Sorry for taking so long to review; just traveling right now. I'll try to review soon. If you explicitly specify a port (https and 443 combined as you identified), then I absolutely agree that Apprise should explicitly make use of it. If it's not, then this is definitely a bug. If its setting a Can you have a look at Have a look at other test cases, even ones in other plugin files for examples if you need too. It's a bit of extra work, but worth it in the end |
Mattermost should not force port to appear in the post URL if not provided in Apprise URL.
Had a quick glance at |
Description:
When we generate a MM notification URL with:
We need to be able to also parse it out with same defaults. However:
This causes failure of notifications due to Port being set to None instead of parsing default port 443or 80 (depending whether secure is True). This PR sets the default port if not provided
New Service Completion Status
%global common_description
Checklist
flake8
)Testing
Anyone can help test this source code as follows: