From 0a605ccb12ae4253dff2cb8d9100420e81017b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 5 Aug 2020 16:24:12 +0200 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=EF=B8=8F=20Action=20b?= =?UTF-8?q?ased=20issue=20labeling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue_labeler.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/issue_labeler.yml diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml new file mode 100644 index 000000000..a8842872f --- /dev/null +++ b/.github/workflows/issue_labeler.yml @@ -0,0 +1,33 @@ +name: "Issue Labeler" +on: + issues: + types: [opened, edited] + +jobs: + apply-label: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + let labels = []; + + if (context.payload.issue.title.match(/\[request\]|feature request/i)) { + labels.push('type:request'); + } + if (context.payload.issue.title.match(/\[brainstorming\]/i)) { + labels.push('type:brainstorming'); + } + if (context.payload.issue.title.match(/\[rc feedback\]/i)) { + labels.push('type:rc feedback'); + } + + if (labels.length > 0) { + github.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: labels + }) + } From ea58e48dad8638e28ef2eff9646501e78524b83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 6 Aug 2020 12:18:58 +0200 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=94=96=20staging/hotfix=20is=201.4.2.?= =?UTF-8?q?dev,=20maintenance=20is=201.4.3.dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .versioneer-lookup | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index 462bf71ee..cdea36dc7 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -18,11 +18,14 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.4.1 +# maintenance is currently the branch for preparation of maintenance release 1.4.3 # so are any fix/... and improve/... branches -maintenance 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev -fix/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev -improve/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev +maintenance 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev +fix/.* 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev +improve/.* 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev + +# staging/hotfix is the branch for preparation of the 1.4.2 hotfix release +staging/hotfix 1.4.2 3ab84ed7e4c3aaaf71fe0f184b465f25d689f929 pep440-dev # staging/maintenance is currently the branch for preparation of 1.4.1rc5 # so is regressionfix/... @@ -32,5 +35,5 @@ regressionfix/.* 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev # staging/devel is currently inactive (but has the 1.4.1rc4 namespace) staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev -# every other branch is a development branch and thus gets resolved to 1.5.0-dev for now -.* 1.5.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev +# every other branch is a development branch and thus gets resolved to 2.0.0.dev for now +.* 2.0.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev From 65d5d8963b666ba483640c8c0c4a8438a67e3486 Mon Sep 17 00:00:00 2001 From: Khoi Date: Wed, 5 Aug 2020 16:19:44 -0400 Subject: [PATCH 3/8] remove any double quotes from filename obtained from content-disposition header, if any --- src/octoprint/util/net.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/octoprint/util/net.py b/src/octoprint/util/net.py index 8e62fd3fa..b0ae0ea5f 100644 --- a/src/octoprint/util/net.py +++ b/src/octoprint/util/net.py @@ -203,6 +203,7 @@ def download_file(url, folder, max_length=None): r.raise_for_status() if "Content-Disposition" in r.headers.keys(): filename = re.findall("filename=(.+)", r.headers["Content-Disposition"])[0] + filename = filename.replace('"', '') # remove any double quotes in the file name else: filename = url.split("/")[-1] From 14a5f89b590d839319232bea46fc773344251c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 6 Aug 2020 11:13:07 +0200 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=90=9B=20Fix=20download=20filename=20?= =?UTF-8?q?parsing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3678 --- src/octoprint/util/net.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/octoprint/util/net.py b/src/octoprint/util/net.py index b0ae0ea5f..0fa252b95 100644 --- a/src/octoprint/util/net.py +++ b/src/octoprint/util/net.py @@ -15,6 +15,7 @@ import re import netifaces import requests +import werkzeug.http _cached_check_v6 = None def check_v6(): @@ -201,10 +202,12 @@ def resolve_host(host): def download_file(url, folder, max_length=None): with requests.get(url, stream=True) as r: r.raise_for_status() + + filename = None if "Content-Disposition" in r.headers.keys(): - filename = re.findall("filename=(.+)", r.headers["Content-Disposition"])[0] - filename = filename.replace('"', '') # remove any double quotes in the file name - else: + _, options = werkzeug.http.parse_options_header(r.headers["Content-Disposition"]) + filename = options.get('filename') + if filename is None: filename = url.split("/")[-1] assert len(filename) > 0 From 8c829048af8ee984cc4b181ca120bd1b932563a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 5 Aug 2020 12:19:36 +0200 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=90=9B=20pmgr:=20fix=20max=20upload?= =?UTF-8?q?=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3674 --- src/octoprint/plugins/pluginmanager/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 2707f9c83..da2f0e879 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -157,7 +157,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, def increase_upload_bodysize(self, current_max_body_sizes, *args, **kwargs): # set a maximum body size of 50 MB for plugin archive uploads - return [("POST", r"/upload_archive", 50 * 1024 * 1024)] + return [("POST", r"/upload_file", 50 * 1024 * 1024)] # Additional permissions hook From b8b3cdde53e17dd7a497b69062f2e60e7daba505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 5 Aug 2020 11:07:21 +0200 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=A5=85=20Better=20resilience=20agains?= =?UTF-8?q?t=20watchdog=20errors=20on=20startup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #3676 --- src/octoprint/server/__init__.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 2f667995d..c5e0433c3 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -818,18 +818,22 @@ class Server(object): self._logger.exception("Something went wrong while attempting to automatically connect to the printer") # start up watchdogs - watched = self._settings.getBaseFolder("watched") - watchdog_handler = util.watchdog.GcodeWatchdogHandler(fileManager, printer) - watchdog_handler.initial_scan(watched) + try: + watched = self._settings.getBaseFolder("watched") + watchdog_handler = util.watchdog.GcodeWatchdogHandler(fileManager, printer) + watchdog_handler.initial_scan(watched) - if self._settings.getBoolean(["feature", "pollWatched"]): - # use less performant polling observer if explicitly configured - observer = PollingObserver() - else: - # use os default - observer = Observer() - observer.schedule(watchdog_handler, watched, recursive=True) - observer.start() + if self._settings.getBoolean(["feature", "pollWatched"]): + # use less performant polling observer if explicitly configured + observer = PollingObserver() + else: + # use os default + observer = Observer() + + observer.schedule(watchdog_handler, watched, recursive=True) + observer.start() + except Exception: + self._logger.exception("Error starting watched folder observer") # run our startup plugins octoprint.plugin.call_plugin(octoprint.plugin.StartupPlugin, From 89412a761a7279cb0e73a24dfcc556cb622665c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 5 Aug 2020 11:10:04 +0200 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=90=9B=20Work=20around=20for=20a=20wa?= =?UTF-8?q?tchdog=20Py2=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the PollingObserver is used under Py2 on a directory that contains utf8 file names, the default listdir implementation (scandir isn't natively available under Py2) will generate unicode instead of str. Due to an insufficent instance check in watchdog that will lead to a misidentification of an entry as an DirEntry object instead of a str, and the attempt to read the name property from that will cause an AttributeError. We monkey patch watchdog to use our bundled scandir backport where needed instead of trying to fix the instance check, as that will perform better anyhow. Closes #3676 --- src/octoprint/server/__init__.py | 1 + src/octoprint/server/util/watchdog.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index c5e0433c3..26eb7a331 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -283,6 +283,7 @@ class Server(object): util.tornado.fix_json_encode() util.tornado.fix_websocket_check_origin() util.flask.fix_flask_jsonify() + util.watchdog.fix_scandir() self._setup_mimetypes() diff --git a/src/octoprint/server/util/watchdog.py b/src/octoprint/server/util/watchdog.py index 7da800542..b94f5010c 100644 --- a/src/octoprint/server/util/watchdog.py +++ b/src/octoprint/server/util/watchdog.py @@ -17,6 +17,30 @@ import octoprint.filemanager.util import octoprint.util +def fix_scandir(): + try: + from os import scandir + # nothing to fix, natively available, return + return + + except ImportError: + # not natively available, use backport + from scandir import scandir + + import watchdog.utils.dirsnapshot + OriginalDirectorySnapshot = watchdog.utils.dirsnapshot.DirectorySnapshot + class FixedDirectorySnapshot(OriginalDirectorySnapshot): + def __init__(self, listdir=scandir, *args, **kwargs): + OriginalDirectorySnapshot.__init__(self, listdir=listdir, *args, **kwargs) + watchdog.utils.dirsnapshot.DirectorySnapshot = FixedDirectorySnapshot + + import watchdog.observers.polling + OriginalPollingEmitter = watchdog.observers.polling.PollingEmitter + class FixedPollingEmitter(OriginalPollingEmitter): + def __init__(self, listdir=scandir, *args, **kwargs): + OriginalPollingEmitter.__init__(self, listdir=listdir, *args, **kwargs) + watchdog.observers.polling.PollingEmitter = FixedPollingEmitter + class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler): """ From 45d3e7c8646c2cf8c2341616830fb492d73874f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 6 Aug 2020 12:41:11 +0200 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=94=96=20Preparing=20hotfix=20release?= =?UTF-8?q?=20of=201.4.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SUPPORTERS.md | 6 +----- src/octoprint/plugins/errortracking/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/SUPPORTERS.md b/SUPPORTERS.md index e2f6ba3c5..f48c48bc0 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -35,7 +35,6 @@ thanks to everyone who contributed! * Kaile Riser * Kale Stedman * Kazuhiro Ogura - * Kelly C McNiece * Kenneth Jiang * Kurt Wubbels * Kyle Menigoz @@ -43,19 +42,16 @@ thanks to everyone who contributed! * Lee Dohm * Makespace Madrid * Mark Walker - * Marvin Nahmias * Michael Aumock * Miles Flavel * Mosaic Manufacturing * Neil R. Goldberg - * Patrick Glyré * Patrick McGinnis * Prof Yuh Wen Chen * Raise3D * Randy C. Will * Ranjib Dey * Richard Michaud - * Rigid3D * Robert Gusek * Ronald Griehsler * Sacha Telgenhof @@ -66,4 +62,4 @@ thanks to everyone who contributed! * Sven Mueller * Ulrich Kempken -and 1932 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)! +and 1943 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)! \ No newline at end of file diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index 034a7767a..d028758eb 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -13,8 +13,8 @@ from octoprint.util.version import get_octoprint_version_string, is_released_oct from flask import jsonify from flask_babel import gettext -SENTRY_URL_SERVER = "https://9a2cb386ed8640e8a7fa0276f613be69@o118517.ingest.sentry.io/1373987" -SENTRY_URL_COREUI = "https://2350156be0954d299dd07a4cef2650b2@o118517.ingest.sentry.io/1374096" +SENTRY_URL_SERVER = "https://d479a74f172d4ac2b959a9a7d0536a82@o118517.ingest.sentry.io/1373987" +SENTRY_URL_COREUI = "https://040577fb88b241ff985e408c11775720@o118517.ingest.sentry.io/1374096" SETTINGS_DEFAULTS = dict(enabled=False, enabled_unreleased=False,