content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
move setting of integration session to constructor
25c2bde7117241226d6e140e3a036c707f9ed14a
<ide><path>actionpack/lib/action_dispatch/testing/integration.rb <ide> module Runner <ide> <ide> attr_reader :app <ide> <add> def initialize(*args, &blk) <add> super(*args, &blk) <add> @integration_session = nil <add> end <add> <ide> def before_setup # :nodoc: <ide> @app = nil <del> @integration_session ||= nil <ide> super <ide> end <ide>
1
PHP
PHP
fix coding standards in configure/
c8b113ac9147c279cd5bd58a05b3a56493d86d46
<ide><path>lib/Cake/Configure/ConfigReaderInterface.php <ide> * @package Cake.Core <ide> */ <ide> interface ConfigReaderInterface { <add> <ide> /** <ide> * Read method is used for reading configuration information from sources. <ide> * These sources can either be static resources like files, or dynamic ones like <ide> interface ConfigReaderInterface { <ide> * @return array An array of data to merge into the runtime configuration <ide> */ <ide> public function read($key); <add> <ide> } <ide><path>lib/Cake/Configure/IniReader.php <ide> protected function _parseNestedValues($values) { <ide> } <ide> return $values; <ide> } <add> <ide> } <ide><path>lib/Cake/Configure/PhpReader.php <ide> * @package Cake.Configure <ide> */ <ide> class PhpReader implements ConfigReaderInterface { <add> <ide> /** <ide> * The path this reader finds files on. <ide> * <ide> public function read($key) { <ide> } <ide> return $config; <ide> } <add> <ide> }
3
Javascript
Javascript
change todomvc to not modify state in place
6e805dda24a4b8ed53379f4aea9e15370512ad54
<ide><path>examples/todomvc/js/app.js <ide> var TodoApp = React.createClass({ <ide> var val = this.refs.newField.getDOMNode().value.trim(); <ide> if (val) { <ide> var todos = this.state.todos; <del> todos.push({ <add> var newTodo = { <ide> id: Utils.uuid(), <ide> title: val, <ide> completed: false <del> }); <del> this.setState({todos: todos}); <add> }; <add> this.setState({todos: todos.concat([newTodo])}); <ide> this.refs.newField.getDOMNode().value = ''; <ide> } <ide> return false;
1
Ruby
Ruby
fix grammatical error on js helper warning message
3475e0ed2402009a72c8e1a4dbf0632c24679fdc
<ide><path>actionpack/lib/action_view/helpers/javascript_helper.rb <ide> def javascript_cdata_section(content) #:nodoc: <ide> # # => <input class="ok" onclick="alert('Hello world!');" type="button" value="Greeting" /> <ide> # <ide> def button_to_function(name, function=nil, html_options={}) <del> message = "button_to_function is deprecated and will be removed from Rails 4.1. We recommend to use Unobtrusive JavaScript instead. " + <add> message = "button_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. " + <ide> "See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript" <ide> ActiveSupport::Deprecation.warn message <ide> <ide> def button_to_function(name, function=nil, html_options={}) <ide> # # => <a class="nav_link" href="#" onclick="alert('Hello world!'); return false;">Greeting</a> <ide> # <ide> def link_to_function(name, function, html_options={}) <del> message = "link_to_function is deprecated and will be removed from Rails 4.1. We recommend to use Unobtrusive JavaScript instead. " + <add> message = "link_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. " + <ide> "See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript" <ide> ActiveSupport::Deprecation.warn message <ide>
1
PHP
PHP
remove namespace from config files
4cc8e6e6a385a4bdc25b56faeeb0cd8e8d178a4e
<ide><path>tests/test_app/Plugin/Company/TestPluginThree/config/bootstrap.php <ide> <?php <del>namespace Company\TestPluginThree\Config; <del> <ide> use Cake\Core\Configure; <ide> <del>Configure::write('PluginTest.test_plugin_three.bootstrap', 'loaded plugin three bootstrap'); <ide>\ No newline at end of file <add>Configure::write('PluginTest.test_plugin_three.bootstrap', 'loaded plugin three bootstrap'); <ide><path>tests/test_app/Plugin/PluginJs/config/bootstrap.php <ide> <?php <del>namespace PluginJs\Config; <del> <ide> use Cake\Core\Configure; <ide> <del>Configure::write('PluginTest.js_plugin.bootstrap', 'loaded js plugin bootstrap'); <ide>\ No newline at end of file <add>Configure::write('PluginTest.js_plugin.bootstrap', 'loaded js plugin bootstrap'); <ide><path>tests/test_app/Plugin/TestPlugin/config/bootstrap.php <ide> <?php <del>namespace TestPlugin\Config; <del> <ide> use Cake\Core\Configure; <ide> <del>Configure::write('PluginTest.test_plugin.bootstrap', 'loaded plugin bootstrap'); <ide>\ No newline at end of file <add>Configure::write('PluginTest.test_plugin.bootstrap', 'loaded plugin bootstrap'); <ide><path>tests/test_app/Plugin/TestPlugin/config/routes.php <ide> <?php <del>namespace TestPlugin\Config; <del> <ide> use Cake\Core\Configure; <ide> <del>Configure::write('PluginTest.test_plugin.routes', 'loaded plugin routes'); <ide>\ No newline at end of file <add>Configure::write('PluginTest.test_plugin.routes', 'loaded plugin routes'); <ide><path>tests/test_app/Plugin/TestPluginFour/config/bootstrap.php <ide> <?php <del>namespace TestPluginFour\Config; <del> <ide> use Cake\Core\Configure; <ide> <ide> Configure::write('PluginTest.test_plugin_four.bootstrap', 'loaded plugin four bootstrap'); <ide><path>tests/test_app/Plugin/TestPluginTwo/config/bootstrap.php <ide> <?php <del>namespace TestPluginTwo\Config; <del> <ide> use Cake\Core\Configure; <ide> <del>Configure::write('PluginTest.test_plugin_two.bootstrap', 'loaded plugin two bootstrap'); <ide>\ No newline at end of file <add>Configure::write('PluginTest.test_plugin_two.bootstrap', 'loaded plugin two bootstrap'); <ide><path>tests/test_app/config/routes.php <ide> * @since 2.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace TestApp\Config; <del> <ide> use Cake\Routing\Router; <ide> <ide> Router::parseExtensions('json');
7
Text
Text
give the correct location for plugin documentation
4b9604381a2101c085119f16140544fc413c2958
<ide><path>experimental/plugins_graphdriver.md <ide> being started. <ide> <ide> # Write a graph driver plugin <ide> <del>See the [plugin documentation](/docs/extend/index.md) for detailed information <add>See the [plugin documentation](https://docs.docker.com/engine/extend/) for detailed information <ide> on the underlying plugin protocol. <ide> <ide>
1
Javascript
Javascript
replace common.fixturesdir with fixtures
bafa2288d8fb73901ecc99a32e8a0f496b6dc953
<ide><path>test/parallel/test-fs-copyfile.js <ide> 'use strict'; <ide> const common = require('../common'); <add>const fixtures = require('../common/fixtures'); <ide> const assert = require('assert'); <ide> const fs = require('fs'); <ide> const path = require('path'); <del>const src = path.join(common.fixturesDir, 'a.js'); <add>const src = fixtures.path('a.js'); <ide> const dest = path.join(common.tmpDir, 'copyfile.out'); <ide> const { COPYFILE_EXCL, UV_FS_COPYFILE_EXCL } = fs.constants; <ide>
1
Text
Text
add examples at assert.strictequal
3ad87994ecfa177e19e6719bf0c6549de580623d
<ide><path>doc/api/assert.md <ide> assert.strictEqual('Hello foobar', 'Hello World!'); <ide> // + 'Hello foobar' <ide> // - 'Hello World!' <ide> // ^ <add> <add>const apples = 1; <add>const oranges = 2; <add>assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); <add>// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 <add> <add>assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); <add>// TypeError: Inputs are not identical <ide> ``` <ide> <ide> If the values are not strictly equal, an `AssertionError` is thrown with a
1
Text
Text
update best practices for entrypoint
6009f2eac4d8d707b64bfada507345e11977643d
<ide><path>docs/sources/articles/dockerfile_best-practices.md <ide> auto-extraction capability, you should always use `COPY`. <ide> <ide> ### [`ENTRYPOINT`](https://docs.docker.com/reference/builder/#entrypoint) <ide> <del>The best use for `ENTRYPOINT` is as a helper script. Using `ENTRYPOINT` for <del>other tasks can make your code harder to understand. For example, <add>The best use for `ENTRYPOINT` is as the main command. <ide> <del>....docker run -it official-image bash <add>Let's start with an example, of an image for the cli tool `s3cmd`: <ide> <del>is much easier to understand than <add> ENTRYPOINT ["s3cmd"] <add> CMD ["--help"] <ide> <del>....docker run -it --entrypoint bash official-image -i <add>Now people who consume this image can easily run commands via syntax like the <add>following: <ide> <del>This is especially true for new Docker users, who might naturally assume the <del>above command will work fine. In cases where an image uses `ENTRYPOINT` for <del>anything other than just a wrapper script, the command will fail and the <del>beginning user will then be forced to learn about `ENTRYPOINT` and <del>`--entrypoint`. <add> $ docker run scmd ls s3://mybucket <ide> <del>In order to avoid a situation where commands are run without clear visibility <del>to the user, make sure your script ends with something like `exec "$@"` (see <del>[the exec builtin command](http://wiki.bash-hackers.org/commands/builtin/exec)). <del>After the entrypoint completes, the script will transparently bootstrap the command <del>invoked by the user, making what has been run clear to the user (for example, <del>`docker run -it mysql mysqld --some --flags` will transparently run <del>`mysqld --some --flags` after `ENTRYPOINT` runs `initdb`). <add>This is nice because the image name can double as a refernce to the binary as <add>shown in the command above. <add> <add>People also often use `ENTRYPOINT` is as a helper script. <ide> <ide> For example, let’s look at the `Dockerfile` for the <ide> [Postgres Official Image](https://github.com/docker-library/postgres).
1
Javascript
Javascript
remove style->csstext attroproties fallback
d96fa37666ddd9b24a077bfccb6a9a532daea23c
<ide><path>src/attributes.js <ide> if ( !jQuery.support.hrefNormalized ) { <ide> }); <ide> } <ide> <add><<<<<<< HEAD <ide> if ( !jQuery.support.style ) { <ide> jQuery.attrHooks.style = { <ide> get: function( elem ) { <ide> if ( !jQuery.support.style ) { <ide> }; <ide> } <ide> <add>======= <add>>>>>>>> 2.0: Remove style->cssText attroproties fallback <ide> // Radios and checkboxes getter/setter <ide> if ( !jQuery.support.checkOn ) { <ide> jQuery.each([ "radio", "checkbox" ], function() { <ide><path>src/support.js <ide> jQuery.support = (function() { <ide> opt = select.appendChild( document.createElement("option") ); <ide> input = div.getElementsByTagName("input")[ 0 ]; <ide> <del> a.style.cssText = "top:1px;float:left;opacity:.5"; <add> a.style.cssText = "float:left;opacity:.5"; <ide> support = { <ide> // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) <ide> getSetAttribute: div.className !== "t", <ide> jQuery.support = (function() { <ide> // This requires a wrapper element in IE <ide> htmlSerialize: !!div.getElementsByTagName("link").length, <ide> <del> // Get the style information from getAttribute <del> // (IE uses .cssText instead) <del> style: /top/.test( a.getAttribute("style") ), <del> <ide> // Make sure that URLs aren't manipulated <ide> // (IE normalizes it by default) <ide> hrefNormalized: a.getAttribute("href") === "/a", <ide><path>test/unit/attributes.js <ide> test( "jQuery.propFix integrity test", function() { <ide> "contenteditable": "contentEditable" <ide> }; <ide> <del> if ( !jQuery.support.enctype ) { <del> props.enctype = "encoding"; <del> } <del> <ide> deepEqual( props, jQuery.propFix, "jQuery.propFix passes integrity check" ); <ide> }); <ide>
3
Text
Text
improve language in upgrading guide
88dff0604f37ad822449897f9385ffa43d6ce2af
<ide><path>guides/source/upgrading_ruby_on_rails.md <ide> end <ide> <ide> while `Bar` could not be autoloaded, autoloading `Foo` would mark `Bar` as autoloaded too. This is not the case in `zeitwerk` mode, you need to move `Bar` to its own file `bar.rb`. One file, one constant. <ide> <del>This affects only to constants at the same top-level as in the example above. Inner classes and modules are fine. For example, consider <add>This only applies to constants at the same top-level as in the example above. Inner classes and modules are fine. For example, consider <ide> <ide> ```ruby <ide> # app/models/foo.rb
1
Javascript
Javascript
verify fields in spawn{sync} errors
d53b636d943df95428d0c6d6700ca2cea6cf87a5
<ide><path>test/parallel/test-child-process-spawn-error.js <ide> var assert = require('assert'); <ide> var errors = 0; <ide> <ide> var enoentPath = 'foo123'; <add>var spawnargs = ['bar']; <ide> assert.equal(common.fileExists(enoentPath), false); <ide> <del>var enoentChild = spawn(enoentPath); <add>var enoentChild = spawn(enoentPath, spawnargs); <ide> enoentChild.on('error', function (err) { <add> assert.equal(err.code, 'ENOENT'); <add> assert.equal(err.errno, 'ENOENT'); <add> assert.equal(err.syscall, 'spawn ' + enoentPath); <ide> assert.equal(err.path, enoentPath); <add> assert.deepEqual(err.spawnargs, spawnargs); <ide> errors++; <ide> }); <ide> <ide><path>test/parallel/test-child-process-spawnsync.js <ide> console.log('sleep exited', stop); <ide> assert.strictEqual(stop[0], 1, 'sleep should not take longer or less than 1 second'); <ide> <ide> // Error test when command does not exist <del>var ret_err = spawnSync('command_does_not_exist'); <del>assert.strictEqual(ret_err.error.code, 'ENOENT'); <add>var ret_err = spawnSync('command_does_not_exist', ['bar']).error; <add> <add>assert.strictEqual(ret_err.code, 'ENOENT'); <add>assert.strictEqual(ret_err.errno, 'ENOENT'); <add>assert.strictEqual(ret_err.syscall, 'spawnSync command_does_not_exist'); <add>assert.strictEqual(ret_err.path, 'command_does_not_exist'); <add>assert.deepEqual(ret_err.spawnargs, ['bar']); <ide> <ide> // Verify that the cwd option works - GH #7824 <ide> (function() {
2
Text
Text
add status and todolist to initialstate
bd4d23c7d69ca6804607ffca48bec8699fa1b31a
<ide><path>docs/tutorials/fundamentals/part-8-modern-redux.md <ide> Let's look at a small standalone example first. <ide> ```js title="createSlice example" <ide> import { createSlice } from '@reduxjs/toolkit' <ide> <del>const initialState = [] <add>const initialState = { <add> entities: [], <add> status: null, <add>} <ide> <ide> const todosSlice = createSlice({ <ide> name: 'todos', <ide> initialState, <ide> reducers: { <ide> todoAdded(state, action) { <ide> // ✅ This "mutating" code is okay inside of createSlice! <del> state.push(action.payload) <add> state.entities.push(action.payload) <ide> }, <ide> todoToggled(state, action) { <del> const todo = state.find(todo => todo.id === action.payload) <add> const todo = state.entities.find(todo => todo.id === action.payload) <ide> todo.completed = !todo.completed <ide> }, <ide> todosLoading(state, action) {
1
Javascript
Javascript
use lazyset in resolvercacheplugin
00fcd1dbe85b11c107e0bba3d940a7e2a31754e4
<ide><path>lib/cache/ResolverCachePlugin.js <ide> <ide> "use strict"; <ide> <add>const LazySet = require("../util/LazySet"); <add> <ide> /** @typedef {import("enhanced-resolve/lib/Resolver")} Resolver */ <ide> /** @typedef {import("../Compiler")} Compiler */ <ide> /** @typedef {import("../FileSystemInfo")} FileSystemInfo */ <ide> /** <ide> * @typedef {Object} CacheEntry <ide> * @property {Object} result <del> * @property {Set<string>} fileDependencies <del> * @property {Set<string>} contextDependencies <del> * @property {Set<string>} missingDependencies <add> * @property {LazySet<string>} fileDependencies <add> * @property {LazySet<string>} contextDependencies <add> * @property {LazySet<string>} missingDependencies <ide> * @property {Snapshot} snapshot <ide> */ <ide> <ide> /** <ide> * @template T <ide> * @param {Set<T> | LazySet<T>} set set to add items to <del> * @param {Set<T>} otherSet set to add items from <add> * @param {Set<T> | LazySet<T>} otherSet set to add items from <ide> * @returns {void} <ide> */ <ide> const addAllToSet = (set, otherSet) => { <ide> class ResolverCachePlugin { <ide> const newResolveContext = { <ide> ...resolveContext, <ide> stack: new Set(), <del> missingDependencies: new Set(), <del> fileDependencies: new Set(), <del> contextDependencies: new Set() <add> missingDependencies: new LazySet(), <add> fileDependencies: new LazySet(), <add> contextDependencies: new LazySet() <ide> }; <ide> const propagate = key => { <ide> if (resolveContext[key]) { <del> for (const dep of newResolveContext[key]) { <del> resolveContext[key].add(dep); <del> } <add> addAllToSet(resolveContext[key], newResolveContext[key]); <ide> } <ide> }; <ide> const resolveTime = Date.now();
1
Javascript
Javascript
calculate the checksumadjustement for the file
9b1d6a5e25571188a34b14d2d9a0b96c92051a2b
<ide><path>fonts.js <ide> var Font = (function Font() { <ide> // to write the table entry information about a table and another offset <ide> // representing the offset where to draw the actual data of a particular <ide> // table <del> var kRequiredTablesCount = 9; <add> var tablesCount = 9; <ide> var offsets = { <ide> currentOffset: 0, <del> virtualOffset: 9 * (4 * 4) <add> virtualOffset: tablesCount * (4 * 4) <ide> }; <ide> <ide> var otf = new Uint8Array(kMaxFontFileSize); <del> createOpenTypeHeader("\x4F\x54\x54\x4F", otf, offsets, 9); <add> createOpenTypeHeader("\x4F\x54\x54\x4F", otf, offsets, tablesCount); <ide> <ide> var charstrings = font.charstrings; <ide> properties.fixedPitch = isFixedPitch(charstrings); <ide> var Font = (function Font() { <ide> for (var field in fields) <ide> createTableEntry(otf, offsets, field, fields[field]); <ide> <add> var headPosition = 0; <ide> for (var field in fields) { <ide> var table = fields[field]; <add> if (field == "head") <add> headPosition = offsets.currentOffset; <add> <ide> otf.set(table, offsets.currentOffset); <ide> offsets.currentOffset += table.length; <ide> } <ide> <add> // Now calculate the checksumAdjustement for all the file and put it into <add> // head. This will make the head checksum incorrect but per spec that's <add> // the way it works. <add> var checksumAdjustement = 0; <add> for (var i = 0; i < offsets.currentOffset; i+=4) <add> checksumAdjustement += int16([otf[i], otf[i+1], otf[i+2], otf[i+3]]); <add> checksumAdjustement = 0xB1B0AFBA - checksumAdjustement; <add> otf.set(stringToArray(string32(checksumAdjustement)), headPosition + (2 * 4)); <add> <add> <ide> var fontData = []; <ide> for (var i = 0; i < offsets.currentOffset; i++) <ide> fontData.push(otf[i]);
1
Javascript
Javascript
add missing file in mini-css-extract-plugin
2872df525b19b06756e8c0f3c40d2d2e1c18e30c
<ide><path>packages/next/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js <add>(()=>{"use strict";var e={213:(e,r,t)=>{var n=t(901);var i=Object.create(null);var a=typeof document==="undefined";var o=Array.prototype.forEach;function debounce(e,r){var t=0;return function(){var n=this;var i=arguments;var a=function functionCall(){return e.apply(n,i)};clearTimeout(t);t=setTimeout(a,r)}}function noop(){}function getCurrentScriptUrl(e){var r=i[e];if(!r){if(document.currentScript){r=document.currentScript.src}else{var t=document.getElementsByTagName("script");var a=t[t.length-1];if(a){r=a.src}}i[e]=r}return function(e){if(!r){return null}var t=r.split(/([^\\/]+)\.js$/);var i=t&&t[1];if(!i){return[r.replace(".js",".css")]}if(!e){return[r.replace(".js",".css")]}return e.split(",").map((function(e){var t=new RegExp("".concat(i,"\\.js$"),"g");return n(r.replace(t,"".concat(e.replace(/{fileName}/g,i),".css")))}))}}function updateCss(e,r){if(!r){if(!e.href){return}r=e.href.split("?")[0]}if(!isUrlRequest(r)){return}if(e.isLoaded===false){return}if(!r||!(r.indexOf(".css")>-1)){return}e.visited=true;var t=e.cloneNode();t.isLoaded=false;t.addEventListener("load",(function(){if(t.isLoaded){return}t.isLoaded=true;e.parentNode.removeChild(e)}));t.addEventListener("error",(function(){if(t.isLoaded){return}t.isLoaded=true;e.parentNode.removeChild(e)}));t.href="".concat(r,"?").concat(Date.now());if(e.nextSibling){e.parentNode.insertBefore(t,e.nextSibling)}else{e.parentNode.appendChild(t)}}function getReloadUrl(e,r){var t;e=n(e,{stripWWW:false});r.some((function(n){if(e.indexOf(r)>-1){t=n}}));return t}function reloadStyle(e){if(!e){return false}var r=document.querySelectorAll("link");var t=false;o.call(r,(function(r){if(!r.href){return}var n=getReloadUrl(r.href,e);if(!isUrlRequest(n)){return}if(r.visited===true){return}if(n){updateCss(r,n);t=true}}));return t}function reloadAll(){var e=document.querySelectorAll("link");o.call(e,(function(e){if(e.visited===true){return}updateCss(e)}))}function isUrlRequest(e){if(!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)){return false}return true}e.exports=function(e,r){if(a){console.log("no window.document found, will not HMR CSS");return noop}var t=getCurrentScriptUrl(e);function update(){var e=t(r.filename);var n=reloadStyle(e);if(r.locals){console.log("[HMR] Detected local css modules. Reload all css");reloadAll();return}if(n){console.log("[HMR] css reload %s",e.join(" "))}else{console.log("[HMR] Reload all css");reloadAll()}}return debounce(update,50)}},901:e=>{function normalizeUrl(e){return e.reduce((function(e,r){switch(r){case"..":e.pop();break;case".":break;default:e.push(r)}return e}),[]).join("/")}e.exports=function(e){e=e.trim();if(/^data:/i.test(e)){return e}var r=e.indexOf("//")!==-1?e.split("//")[0]+"//":"";var t=e.replace(new RegExp(r,"i"),"").split("/");var n=t[0].toLowerCase().replace(/\.$/,"");t[0]="";var i=normalizeUrl(t);return r+n+i}}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var i=r[t]={exports:{}};var a=true;try{e[t](i,i.exports,__nccwpck_require__);a=false}finally{if(a)delete r[t]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(213);module.exports=t})(); <ide>\ No newline at end of file <ide><path>packages/next/taskfile.js <ide> export async function ncc_minimatch(task, opts) { <ide> // eslint-disable-next-line camelcase <ide> externals['mini-css-extract-plugin'] = <ide> 'next/dist/compiled/mini-css-extract-plugin' <add> <ide> export async function ncc_mini_css_extract_plugin(task, opts) { <ide> await task <ide> .source( <ide> export async function ncc_mini_css_extract_plugin(task, opts) { <ide> }, <ide> }) <ide> .target('compiled/mini-css-extract-plugin') <add> await task <add> .source( <add> relative( <add> __dirname, <add> resolve( <add> require.resolve('mini-css-extract-plugin'), <add> '../hmr/hotModuleReplacement.js' <add> ) <add> ) <add> ) <add> .ncc({ <add> externals: { <add> ...externals, <add> './hmr': './hmr', <add> 'schema-utils': 'next/dist/compiled/schema-utils3', <add> }, <add> }) <add> .target('compiled/mini-css-extract-plugin/hmr') <ide> await task <ide> .source( <ide> opts.src ||
2
Python
Python
add correlate/convolve benchmarks
af13636c8611415df5b1e5d90be3f6fb975f6e0d
<ide><path>benchmarks/benchmarks/bench_core.py <ide> <ide> from .common import Benchmark <ide> <del>import numpy <add>import numpy as np <ide> <ide> <ide> class Core(Benchmark): <ide> def setup(self): <ide> self.l100 = range(100) <ide> self.l50 = range(50) <del> self.l = [numpy.arange(1000), numpy.arange(1000)] <del> self.l10x10 = numpy.ones((10, 10)) <add> self.l = [np.arange(1000), np.arange(1000)] <add> self.l10x10 = np.ones((10, 10)) <ide> <ide> def time_array_1(self): <del> numpy.array(1) <add> np.array(1) <ide> <ide> def time_array_empty(self): <del> numpy.array([]) <add> np.array([]) <ide> <ide> def time_array_l1(self): <del> numpy.array([1]) <add> np.array([1]) <ide> <ide> def time_array_l100(self): <del> numpy.array(self.l100) <add> np.array(self.l100) <ide> <ide> def time_array_l(self): <del> numpy.array(self.l) <add> np.array(self.l) <ide> <ide> def time_vstack_l(self): <del> numpy.vstack(self.l) <add> np.vstack(self.l) <ide> <ide> def time_hstack_l(self): <del> numpy.hstack(self.l) <add> np.hstack(self.l) <ide> <ide> def time_dstack_l(self): <del> numpy.dstack(self.l) <add> np.dstack(self.l) <ide> <ide> def time_arange_100(self): <del> numpy.arange(100) <add> np.arange(100) <ide> <ide> def time_zeros_100(self): <del> numpy.zeros(100) <add> np.zeros(100) <ide> <ide> def time_ones_100(self): <del> numpy.ones(100) <add> np.ones(100) <ide> <ide> def time_empty_100(self): <del> numpy.empty(100) <add> np.empty(100) <ide> <ide> def time_eye_100(self): <del> numpy.eye(100) <add> np.eye(100) <ide> <ide> def time_identity_100(self): <del> numpy.identity(100) <add> np.identity(100) <ide> <ide> def time_eye_3000(self): <del> numpy.eye(3000) <add> np.eye(3000) <ide> <ide> def time_identity_3000(self): <del> numpy.identity(3000) <add> np.identity(3000) <ide> <ide> def time_diag_l100(self): <del> numpy.diag(self.l100) <add> np.diag(self.l100) <ide> <ide> def time_diagflat_l100(self): <del> numpy.diagflat(self.l100) <add> np.diagflat(self.l100) <ide> <ide> def time_diagflat_l50_l50(self): <del> numpy.diagflat([self.l50, self.l50]) <add> np.diagflat([self.l50, self.l50]) <ide> <ide> def time_triu_l10x10(self): <del> numpy.triu(self.l10x10) <add> np.triu(self.l10x10) <ide> <ide> def time_tril_l10x10(self): <del> numpy.tril(self.l10x10) <add> np.tril(self.l10x10) <ide> <ide> <ide> class MA(Benchmark): <ide> def setup(self): <ide> self.t100 = ([True] * 100) <ide> <ide> def time_masked_array(self): <del> numpy.ma.masked_array() <add> np.ma.masked_array() <ide> <ide> def time_masked_array_l100(self): <del> numpy.ma.masked_array(self.l100) <add> np.ma.masked_array(self.l100) <ide> <ide> def time_masked_array_l100_t100(self): <del> numpy.ma.masked_array(self.l100, self.t100) <add> np.ma.masked_array(self.l100, self.t100) <add> <add> <add>class CorrConv(Benchmark): <add> params = [[50, 1000, 1e5], <add> [10, 100, 1000, 1e4], <add> ['valid', 'same', 'full']] <add> param_names = ['size1', 'size2', 'mode'] <add> <add> def setup(self, size1, size2, mode): <add> self.x1 = np.linspace(0, 1, num=size1) <add> self.x2 = np.cos(np.linspace(0, 2*np.pi, num=size2)) <add> <add> def time_correlate(self, size1, size2, mode): <add> np.correlate(self.x1, self.x2, mode=mode) <add> <add> def time_convolve(self, size1, size2, mode): <add> np.convolve(self.x1, self.x2, mode=mode)
1
PHP
PHP
use cache get default value
c81ee6a0522fda78a12da6a0e1ef15c673dab338
<ide><path>src/Illuminate/Session/CookieSessionHandler.php <ide> public function close() <ide> */ <ide> public function read($sessionId) <ide> { <del> return $this->request->cookies->get($sessionId, ''); <add> return $this->request->cookies->get($sessionId) ?: ''; <ide> } <ide> <ide> /**
1
Go
Go
remove job from stop
04cc6c6aa4f8ea656d23268b7bff0136e4fc6c8d
<ide><path>api/server/server.go <ide> func postContainersStop(eng *engine.Engine, version version.Version, w http.Resp <ide> if vars == nil { <ide> return fmt.Errorf("Missing parameter") <ide> } <del> job := eng.Job("stop", vars["name"]) <del> job.Setenv("t", r.Form.Get("t")) <del> if err := job.Run(); err != nil { <add> <add> d := getDaemon(eng) <add> seconds, err := strconv.Atoi(r.Form.Get("t")) <add> if err != nil { <add> return err <add> } <add> <add> if err := d.ContainerStop(vars["name"], seconds); err != nil { <ide> if err.Error() == "Container already stopped" { <ide> w.WriteHeader(http.StatusNotModified) <ide> return nil <ide> } <ide> return err <ide> } <ide> w.WriteHeader(http.StatusNoContent) <add> <ide> return nil <ide> } <ide> <ide><path>daemon/daemon.go <ide> func (daemon *Daemon) Install(eng *engine.Engine) error { <ide> "logs": daemon.ContainerLogs, <ide> "restart": daemon.ContainerRestart, <ide> "start": daemon.ContainerStart, <del> "stop": daemon.ContainerStop, <ide> "execCreate": daemon.ContainerExecCreate, <ide> "execStart": daemon.ContainerExecStart, <ide> "execInspect": daemon.ContainerExecInspect, <ide><path>daemon/stop.go <ide> package daemon <ide> <del>import ( <del> "fmt" <add>import "fmt" <ide> <del> "github.com/docker/docker/engine" <del>) <del> <del>func (daemon *Daemon) ContainerStop(job *engine.Job) error { <del> if len(job.Args) != 1 { <del> return fmt.Errorf("Usage: %s CONTAINER\n", job.Name) <del> } <del> var ( <del> name = job.Args[0] <del> t = 10 <del> ) <del> if job.EnvExists("t") { <del> t = job.GetenvInt("t") <del> } <add>func (daemon *Daemon) ContainerStop(name string, seconds int) error { <ide> container, err := daemon.Get(name) <ide> if err != nil { <ide> return err <ide> } <ide> if !container.IsRunning() { <ide> return fmt.Errorf("Container already stopped") <ide> } <del> if err := container.Stop(int(t)); err != nil { <add> if err := container.Stop(seconds); err != nil { <ide> return fmt.Errorf("Cannot stop container %s: %s\n", name, err) <ide> } <ide> container.LogEvent("stop")
3
Javascript
Javascript
remove obsolete function escapeheadervalue
117fef45587288b07b39172d73a4c00716e6064d
<ide><path>lib/_http_outgoing.js <ide> function processHeader(self, state, key, value, validate) { <ide> function storeHeader(self, state, key, value, validate) { <ide> if (validate) <ide> validateHeaderValue(key, value); <del> state.header += key + ': ' + escapeHeaderValue(value) + CRLF; <add> state.header += key + ': ' + value + CRLF; <ide> matchHeader(self, state, key, value); <ide> } <ide> <ide> function connectionCorkNT(msg, conn) { <ide> } <ide> <ide> <del>function escapeHeaderValue(value) { <del> // Protect against response splitting. The regex test is there to <del> // minimize the performance impact in the common case. <del> return /[\r\n]/.test(value) ? value.replace(/[\r\n]+[ \t]*/g, '') : value; <del>} <del> <del> <ide> OutgoingMessage.prototype.addTrailers = function addTrailers(headers) { <ide> this._trailer = ''; <ide> var keys = Object.keys(headers); <ide> OutgoingMessage.prototype.addTrailers = function addTrailers(headers) { <ide> debug('Trailer "%s" contains invalid characters', field); <ide> throw new ERR_INVALID_CHAR('trailer content', field); <ide> } <del> this._trailer += field + ': ' + escapeHeaderValue(value) + CRLF; <add> this._trailer += field + ': ' + value + CRLF; <ide> } <ide> }; <ide>
1
Javascript
Javascript
add tests and clean up resolveobjectkey helper
183637b87f928c3d62991de764d15228f1a19338
<ide><path>src/helpers/helpers.core.js <ide> export function _deprecated(scope, value, previous, current) { <ide> } <ide> <ide> export function resolveObjectKey(obj, key) { <del> if (key.length < 3) { <del> return obj[key]; <add> // Special cases for `x` and `y` keys. It's quite a lot faster to aceess this way. <add> // Those are the default keys Chart.js is resolving, so it makes sense to be fast. <add> if (key === 'x') { <add> return obj.x; <add> } <add> if (key === 'y') { <add> return obj.y; <ide> } <ide> const keys = key.split('.'); <del> for (let i = 0, n = keys.length; i < n; ++i) { <add> for (let i = 0, n = keys.length; i < n && obj; ++i) { <ide> const k = keys[i]; <del> if (k in obj) { <del> obj = obj[k]; <del> } else { <del> return; <add> if (!k) { <add> break; <ide> } <add> obj = obj[k]; <ide> } <ide> return obj; <ide> } <ide><path>test/specs/helpers.core.tests.js <ide> describe('Chart.helpers.core', function() { <ide> expect(output.o.a).not.toBe(a1); <ide> }); <ide> }); <add> <add> describe('resolveObjectKey', function() { <add> it('should resolve empty key to root object', function() { <add> const obj = {test: true}; <add> expect(helpers.resolveObjectKey(obj, '')).toEqual(obj); <add> }); <add> it('should resolve one level', function() { <add> const obj = { <add> bool: true, <add> str: 'test', <add> int: 42, <add> obj: {name: 'object'} <add> }; <add> expect(helpers.resolveObjectKey(obj, 'bool')).toEqual(true); <add> expect(helpers.resolveObjectKey(obj, 'str')).toEqual('test'); <add> expect(helpers.resolveObjectKey(obj, 'int')).toEqual(42); <add> expect(helpers.resolveObjectKey(obj, 'obj')).toEqual(obj.obj); <add> }); <add> it('should resolve multiple levels', function() { <add> const obj = { <add> child: { <add> level: 1, <add> child: { <add> level: 2, <add> child: { <add> level: 3 <add> } <add> } <add> } <add> }; <add> expect(helpers.resolveObjectKey(obj, 'child.level')).toEqual(1); <add> expect(helpers.resolveObjectKey(obj, 'child.child.level')).toEqual(2); <add> expect(helpers.resolveObjectKey(obj, 'child.child.child.level')).toEqual(3); <add> }); <add> it('should resolve circular reference', function() { <add> const root = {}; <add> const child = {root}; <add> child.child = child; <add> root.child = child; <add> expect(helpers.resolveObjectKey(root, 'child')).toEqual(child); <add> expect(helpers.resolveObjectKey(root, 'child.child.child.child.child.child')).toEqual(child); <add> expect(helpers.resolveObjectKey(root, 'child.child.root')).toEqual(root); <add> }); <add> it('should break at empty key', function() { <add> const obj = { <add> child: { <add> level: 1, <add> child: { <add> level: 2, <add> child: { <add> level: 3 <add> } <add> } <add> } <add> }; <add> expect(helpers.resolveObjectKey(obj, 'child..level')).toEqual(obj.child); <add> expect(helpers.resolveObjectKey(obj, 'child.child.level...')).toEqual(2); <add> expect(helpers.resolveObjectKey(obj, '.')).toEqual(obj); <add> expect(helpers.resolveObjectKey(obj, '..')).toEqual(obj); <add> }); <add> it('should resolve undefined', function() { <add> const obj = { <add> child: { <add> level: 1, <add> child: { <add> level: 2, <add> child: { <add> level: 3 <add> } <add> } <add> } <add> }; <add> expect(helpers.resolveObjectKey(obj, 'level')).toEqual(undefined); <add> expect(helpers.resolveObjectKey(obj, 'child.level.a')).toEqual(undefined); <add> }); <add> it('should throw on invalid input', function() { <add> expect(() => helpers.resolveObjectKey(undefined, undefined)).toThrow(); <add> expect(() => helpers.resolveObjectKey({}, null)).toThrow(); <add> expect(() => helpers.resolveObjectKey({}, false)).toThrow(); <add> expect(() => helpers.resolveObjectKey({}, true)).toThrow(); <add> expect(() => helpers.resolveObjectKey({}, 1)).toThrow(); <add> }); <add> }); <ide> });
2
Ruby
Ruby
stop nil checking on safe_append=
97ef636191933f1d4abc92fc10871e6d1195285c
<ide><path>actionview/lib/action_view/buffers.rb <ide> def <<(value) <ide> end <ide> alias :append= :<< <ide> <del> def safe_concat(value) <del> return self if value.nil? <del> super(value.to_s) <del> end <ide> alias :safe_append= :safe_concat <ide> end <ide>
1
Javascript
Javascript
fix object detection
14c0fe44328f22debb5b531d2b671923658542b3
<ide><path>src/serialize.js <ide> function buildParams( prefix, obj, traditional, add ) { <ide> <ide> // Item is non-scalar (array or object), encode its numeric index. <ide> buildParams( <del> prefix + "[" + ( jQuery.type( v ) === "object" ? i : "" ) + "]", <add> prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", <ide> v, <ide> traditional, <ide> add
1
Javascript
Javascript
fix directive as identifier
be621934edca1efef80cb24752fad4e1e915739f
<ide><path>src/ng/compile.js <ide> function $CompileProvider($provide) { <ide> controllerInstance); <ide> if (directive.controllerAs) { <ide> if (typeof locals.$scope !== 'object') { <del> throw new Error('Can not export controller as "' + identifier + '". ' + <add> throw new Error('Can not export controller as "' + directive.controllerAs + '". ' + <ide> 'No scope object provided!'); <ide> } <ide>
1
Javascript
Javascript
combine displayname using underscore
755cc9671ff92c5c61785398298b593ea97c7735
<ide><path>src/test/ReactPerf.js <ide> var ReactPerf = { <ide> } <ide> return func.apply(this, arguments); <ide> }; <del> wrapper.displayName = objName + '.' + fnName; <add> wrapper.displayName = objName + '_' + fnName; <ide> return wrapper; <ide> } <ide> return func;
1
PHP
PHP
allow username of 0 in basic authentication
975e4c3af0ffa6774275de788f87fd479aff074b
<ide><path>lib/Cake/Controller/Component/Auth/BasicAuthenticate.php <ide> public function getUser(CakeRequest $request) { <ide> $username = env('PHP_AUTH_USER'); <ide> $pass = env('PHP_AUTH_PW'); <ide> <del> if (empty($username) || empty($pass)) { <add> if (!is_string($username) || $username === '' || !is_string($pass) || $pass === '') { <ide> return false; <ide> } <ide> return $this->_findUser($username, $pass); <ide><path>lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php <ide> public function testAuthenticateInjection() { <ide> $_SERVER['PHP_AUTH_PW'] = "' OR 1 = 1"; <ide> <ide> $this->assertFalse($this->auth->getUser($request)); <del> <ide> $this->assertFalse($this->auth->authenticate($request, $this->response)); <ide> } <ide> <add>/** <add> * Test that username of 0 works. <add> * <add> * @return void <add> */ <add> public function testAuthenticateUsernameZero() { <add> $User = ClassRegistry::init('User'); <add> $User->updateAll(array('user' => $User->getDataSource()->value('0')), array('user' => 'mariano')); <add> <add> $request = new CakeRequest('posts/index', false); <add> $request->data = array('User' => array( <add> 'user' => '0', <add> 'password' => 'password' <add> )); <add> $_SERVER['PHP_AUTH_USER'] = '0'; <add> $_SERVER['PHP_AUTH_PW'] = 'password'; <add> <add> $expected = array( <add> 'id' => 1, <add> 'user' => '0', <add> 'created' => '2007-03-17 01:16:23', <add> 'updated' => '2007-03-17 01:18:31' <add> ); <add> $this->assertEquals($expected, $this->auth->authenticate($request, $this->response)); <add> } <add> <ide> /** <ide> * test that challenge headers are sent when no credentials are found. <ide> *
2
PHP
PHP
add test for collection keyby closure
52fd8b764fa699bfce412d89f8e5aea30e4fdcc8
<ide><path>tests/Support/SupportCollectionTest.php <ide> public function testGroupByAttribute() <ide> public function testKeyByAttribute() <ide> { <ide> $data = new Collection([['rating' => 1, 'name' => '1'], ['rating' => 2, 'name' => '2'], ['rating' => 3, 'name' => '3']]); <add> <ide> $result = $data->keyBy('rating'); <ide> $this->assertEquals([1 => ['rating' => 1, 'name' => '1'], 2 => ['rating' => 2, 'name' => '2'], 3 => ['rating' => 3, 'name' => '3']], $result->all()); <add> <add> $result = $data->keyBy(function($item){ return $item['rating'] * 2; }); <add> $this->assertEquals([2 => ['rating' => 1, 'name' => '1'], 4 => ['rating' => 2, 'name' => '2'], 6 => ['rating' => 3, 'name' => '3']], $result->all()); <ide> } <ide> <ide>
1
PHP
PHP
remove throw in boundmethod
826a90f660016bd66326ae823a077ae10a868b28
<ide><path>src/Illuminate/Container/BoundMethod.php <ide> namespace Illuminate\Container; <ide> <ide> use Closure; <del>use Illuminate\Contracts\Container\BindingResolutionException; <ide> use InvalidArgumentException; <ide> use ReflectionFunction; <ide> use ReflectionMethod; <ide> protected static function addDependencyForCallParameter($container, $parameter, <ide> } <ide> } elseif ($parameter->isDefaultValueAvailable()) { <ide> $dependencies[] = $parameter->getDefaultValue(); <del> } elseif (! $parameter->isOptional() && ! array_key_exists($paramName, $parameters)) { <del> $message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}"; <del> <del> throw new BindingResolutionException($message); <ide> } <ide> } <ide> <ide><path>tests/Container/ContainerCallTest.php <ide> public function testCallWithBoundMethod() <ide> $this->assertSame('taylor', $result[1]); <ide> } <ide> <add> public function testCallWithUnnamedParameters() <add> { <add> $container = new Container; <add> $result = $container->call([new ContainerTestCallStub, 'unresolvable'], ['foo', 'bar']); <add> $this->assertEquals(['foo', 'bar'], $result); <add> } <add> <ide> public function testBindMethodAcceptsAnArray() <ide> { <ide> $container = new Container;
2
PHP
PHP
fix windows path
69689061c177ae06c9da9015eede47cc24bed670
<ide><path>src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php <ide> private function getConfigurationNesting(SplFileInfo $file) <ide> { <ide> $directory = dirname($file->getRealPath()); <ide> <del> if ($tree = trim(str_replace(config_path(), '', $directory), DIRECTORY_SEPARATOR)) <add> if ($tree = trim(str_replace(str_replace('/', '\\', config_path()), '', $directory), DIRECTORY_SEPARATOR)) <ide> { <ide> $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.'; <ide> }
1
Text
Text
add kubernetes instructions to bug_report
66962b40abd296842fb3984d2c004180162d6de4
<ide><path>.github/ISSUE_TEMPLATE/bug_report.md <ide> This questions are the first thing we need to know to understand the context. <ide> <ide> **Apache Airflow version**: <ide> <add> <add>**Kubernetes version (if you are using kubernetes)** (use `kubectl version`): <add> <add>**Environment**: <add> <add>- **Cloud provider or hardware configuration**: <add>- **OS** (e.g. from /etc/os-release): <add>- **Kernel** (e.g. `uname -a`): <add>- **Install tools**: <add>- **Others**: <ide> **What happened**: <ide> <ide> <!-- (please include exact error messages if you can) --> <ide> This questions are the first thing we need to know to understand the context. <ide> <ide> As minimally and precisely as possible. Keep in mind we do not have access to your cluster or dags. <ide> <add>If you are using kubernetes, please attempt to recreate the issue using minikube or kind. <add> <add>## Install minikube/kind <add> <add>- Minikube https://minikube.sigs.k8s.io/docs/start/ <add>- Kind https://kind.sigs.k8s.io/docs/user/quick-start/ <add> <ide> If this is a UI bug, please provide a screenshot of the bug or a link to a youtube video of the bug in action <ide> <ide> You can include images using the .md sytle of <ide> Any relevant logs to include? Put them here in side a detail tag: <ide> <details><summary>x.log</summary> lots of stuff </details> <ide> <ide> --> <add>
1
Java
Java
fix broken text padding on nodes
3766ec9764560be58db95dae5a60b1532e85218b
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatNativeViewHierarchyManager.java <ide> import javax.annotation.Nullable; <ide> <ide> import java.util.ArrayList; <del>import java.util.Collection; <ide> import java.util.List; <ide> <ide> import android.util.SparseArray; <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java <ide> protected void collectState( <ide> <ide> Spacing padding = getPadding(); <ide> <del> left += padding.get(Spacing.LEFT); <add> left += padding.get(Spacing.START); <ide> top += padding.get(Spacing.TOP); <ide> <ide> // these are actual right/bottom coordinates where this DrawCommand will draw.
2
PHP
PHP
fix issue with habtm fields
1743eaa7769d43f2be8bec6bec4ba698131e64fa
<ide><path>lib/Cake/Test/Case/View/HelperTest.php <ide> public function testSetEntityAssociated() { <ide> $this->assertEquals($expected, $this->Helper->entity()); <ide> <ide> $this->assertEquals('HelperTestComment', $this->Helper->model()); <del> <ide> } <ide> <ide> /** <ide> public function testSetEntityAssociated() { <ide> * @return void <ide> */ <ide> public function testSetEntityAssociatedCamelCaseField() { <del> $this->Helper->fieldset = array('HelperTestComment' => array('fields' => array('BigField' => 'something'))); <add> $this->Helper->fieldset = array( <add> 'HelperTestComment' => array( <add> 'fields' => array('BigField' => array('type' => 'integer')) <add> ) <add> ); <ide> $this->Helper->setEntity('HelperTestComment', true); <ide> $this->Helper->setEntity('HelperTestComment.BigField'); <ide> <ide> $this->assertEquals('HelperTestComment', $this->Helper->model()); <ide> $this->assertEquals('BigField', $this->Helper->field()); <ide> } <ide> <add>/** <add> * Test that multiple fields work when they are camelcase and in fieldset <add> * <add> * @return void <add> */ <add> public function testSetEntityAssociatedCamelCaseFieldHabtmMultiple() { <add> $this->Helper->fieldset = array( <add> 'HelperTestComment' => array( <add> 'fields' => array('Tag' => array('type' => 'multiple')) <add> ) <add> ); <add> $this->Helper->setEntity('HelperTestComment', true); <add> $this->Helper->setEntity('Tag'); <add> <add> $this->assertEquals('Tag', $this->Helper->model()); <add> $this->assertEquals('Tag', $this->Helper->field()); <add> $this->assertEquals(array('Tag', 'Tag'), $this->Helper->entity()); <add> } <add> <ide> /** <ide> * test that 'view' doesn't break things. <ide> * <ide><path>lib/Cake/View/Helper.php <ide> public function setEntity($entity, $setScope = false) { <ide> <ide> $this->_association = null; <ide> <del> // check for associated model. <del> $reversed = array_reverse($parts); <del> foreach ($reversed as $part) { <del> if (empty($this->fieldset[$this->_modelScope]['fields'][$part]) && preg_match('/^[A-Z]/', $part)) { <del> $this->_association = $part; <del> break; <del> } <del> } <del> <ide> // habtm models are special <ide> if ( <ide> isset($this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type']) && <ide> $this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type'] === 'multiple' <ide> ) { <add> $this->_association = $parts[0]; <ide> $entity = $parts[0] . '.' . $parts[0]; <add> } else { <add> // check for associated model. <add> $reversed = array_reverse($parts); <add> foreach ($reversed as $part) { <add> if ( <add> !isset($this->fieldset[$this->_modelScope]['fields'][$part]) && <add> preg_match('/^[A-Z]/', $part) <add> ) { <add> $this->_association = $part; <add> break; <add> } <add> } <ide> } <del> <ide> $this->_entityPath = $entity; <ide> return; <ide> }
2
PHP
PHP
fix doc blocks and stuff
a4f6d51c27864b77d062317ef6bf80de4aee9cc4
<ide><path>src/Illuminate/Filesystem/Filesystem.php <ide> public function copyDirectory($directory, $destination, $options = null) <ide> * <ide> * @param string $directory <ide> * @param bool $preserve <del> * @return void <add> * @return bool <ide> */ <ide> public function deleteDirectory($directory, $preserve = false) <ide> { <ide> public function deleteDirectory($directory, $preserve = false) <ide> * Empty the specified directory of all files and folders. <ide> * <ide> * @param string $directory <del> * @return void <add> * @return bool <ide> */ <ide> public function cleanDirectory($directory) <ide> { <del> <ide> return $this->deleteDirectory($directory, true); <ide> } <ide>
1
Go
Go
add build command
e2880950c5ea721be00a814d93ea256feb9f98bb
<ide><path>commands.go <ide> import ( <ide> "log" <ide> "net/http" <ide> "net/url" <add> "os" <ide> "path/filepath" <ide> "runtime" <ide> "strconv"
1
PHP
PHP
fix separator for windows os
5b2a3793bea91c07369cdba457695ddf9ac54ad3
<ide><path>tests/Console/Scheduling/EventTest.php <ide> public function testCustomMutexName() <ide> $event = new Event(m::mock(EventMutex::class), 'php -i'); <ide> $event->description('Fancy command description'); <ide> <del> $this->assertSame('framework/schedule-eeb46c93d45e928d62aaf684d727e213b7094822', $event->mutexName()); <add> $this->assertSame('framework'.DIRECTORY_SEPARATOR.'schedule-eeb46c93d45e928d62aaf684d727e213b7094822', $event->mutexName()); <ide> <ide> $event->createMutexNameUsing(function (Event $event) { <ide> return Str::slug($event->description);
1
Mixed
Javascript
add optional code to warnings + type checking
5e1f32fd94f53acbec6c5f6eb4d2de5fdef2cd67
<ide><path>doc/api/process.md <ide> console.log(process.env.test); <ide> // => 1 <ide> ``` <ide> <del>## process.emitWarning(warning[, name][, ctor]) <add>## process.emitWarning(warning[, type[, code]][, ctor]) <ide> <!-- YAML <ide> added: v6.0.0 <ide> --> <ide> <ide> * `warning` {String | Error} The warning to emit. <del>* `name` {String} When `warning` is a String, `name` is the name to use <del> for the warning. Default: `Warning`. <add>* `type` {String} When `warning` is a String, `type` is the name to use <add> for the *type* of warning being emitted. Default: `Warning`. <add>* `code` {String} A unique identifier for the warning instance being emitted. <ide> * `ctor` {Function} When `warning` is a String, `ctor` is an optional <ide> function used to limit the generated stack trace. Default <ide> `process.emitWarning` <ide> process.emitWarning('Something happened!'); <ide> ``` <ide> <ide> ```js <del>// Emit a warning using a string and a name... <add>// Emit a warning using a string and a type... <ide> process.emitWarning('Something Happened!', 'CustomWarning'); <ide> // Emits: (node:56338) CustomWarning: Something Happened! <ide> ``` <ide> <add>```js <add>process.emitWarning('Something happened!', 'CustomWarning', 'WARN001'); <add>// Emits: (node:56338) CustomWarning [WARN001]: Something Happened! <add>``` <add> <ide> In each of the previous examples, an `Error` object is generated internally by <ide> `process.emitWarning()` and passed through to the <ide> [`process.on('warning')`][process_warning] event. <ide> In each of the previous examples, an `Error` object is generated internally by <ide> process.on('warning', (warning) => { <ide> console.warn(warning.name); <ide> console.warn(warning.message); <add> console.warn(warning.code); <ide> console.warn(warning.stack); <ide> }); <ide> ``` <ide> <ide> If `warning` is passed as an `Error` object, it will be passed through to the <del>`process.on('warning')` event handler unmodified (and the optional `name` <del>and `ctor` arguments will be ignored): <add>`process.on('warning')` event handler unmodified (and the optional `type`, <add>`code` and `ctor` arguments will be ignored): <ide> <ide> ```js <ide> // Emit a warning using an Error object... <ide> const myWarning = new Error('Warning! Something happened!'); <add>// Use the Error name property to specify the type name <ide> myWarning.name = 'CustomWarning'; <add>myWarning.code = 'WARN001'; <ide> <ide> process.emitWarning(myWarning); <del>// Emits: (node:56338) CustomWarning: Warning! Something Happened! <add>// Emits: (node:56338) CustomWarning [WARN001]: Warning! Something Happened! <ide> ``` <ide> <ide> A `TypeError` is thrown if `warning` is anything other than a string or `Error` <ide> object. <ide> Note that while process warnings use `Error` objects, the process warning <ide> mechanism is **not** a replacement for normal error handling mechanisms. <ide> <del>The following additional handling is implemented if the warning `name` is <add>The following additional handling is implemented if the warning `type` is <ide> `DeprecationWarning`: <ide> <ide> * If the `--throw-deprecation` command-line flag is used, the deprecation <ide><path>lib/internal/process/warning.js <ide> function setupProcessWarnings() { <ide> const trace = process.traceProcessWarnings || <ide> (isDeprecation && process.traceDeprecation); <ide> if (trace && warning.stack) { <del> console.error(`${prefix}${warning.stack}`); <add> if (warning.code) { <add> console.error(`${prefix}[${warning.code}] ${warning.stack}`); <add> } else { <add> console.error(`${prefix}${warning.stack}`); <add> } <ide> } else { <del> var toString = warning.toString; <del> if (typeof toString !== 'function') <del> toString = Error.prototype.toString; <del> console.error(`${prefix}${toString.apply(warning)}`); <add> const toString = <add> typeof warning.toString === 'function' ? <add> warning.toString : Error.prototype.toString; <add> if (warning.code) { <add> console.error( <add> `${prefix}[${warning.code}] ${toString.apply(warning)}`); <add> } else { <add> console.error(`${prefix}${toString.apply(warning)}`); <add> } <ide> } <ide> }); <ide> } <ide> <ide> // process.emitWarning(error) <del> // process.emitWarning(str[, name][, ctor]) <del> process.emitWarning = function(warning, name, ctor) { <del> if (typeof name === 'function') { <del> ctor = name; <del> name = 'Warning'; <add> // process.emitWarning(str[, type[, code]][, ctor]) <add> process.emitWarning = function(warning, type, code, ctor) { <add> if (typeof type === 'function') { <add> ctor = type; <add> code = undefined; <add> type = 'Warning'; <ide> } <add> if (typeof code === 'function') { <add> ctor = code; <add> code = undefined; <add> } <add> if (code !== undefined && typeof code !== 'string') <add> throw new TypeError('\'code\' must be a String'); <add> if (type !== undefined && typeof type !== 'string') <add> throw new TypeError('\'type\' must be a String'); <ide> if (warning === undefined || typeof warning === 'string') { <ide> warning = new Error(warning); <del> warning.name = name || 'Warning'; <add> warning.name = String(type || 'Warning'); <add> if (code !== undefined) warning.code = code; <ide> Error.captureStackTrace(warning, ctor || process.emitWarning); <ide> } <ide> if (!(warning instanceof Error)) { <ide><path>test/parallel/test-process-emitwarning.js <ide> const util = require('util'); <ide> process.on('warning', common.mustCall((warning) => { <ide> assert(warning); <ide> assert(/^(Warning|CustomWarning)/.test(warning.name)); <del> assert(warning.message, 'A Warning'); <del>}, 7)); <add> assert.strictEqual(warning.message, 'A Warning'); <add> if (warning.code) assert.strictEqual(warning.code, 'CODE001'); <add>}, 8)); <ide> <ide> process.emitWarning('A Warning'); <ide> process.emitWarning('A Warning', 'CustomWarning'); <ide> process.emitWarning('A Warning', CustomWarning); <ide> process.emitWarning('A Warning', 'CustomWarning', CustomWarning); <add>process.emitWarning('A Warning', 'CustomWarning', 'CODE001'); <ide> <ide> function CustomWarning() { <ide> Error.call(this); <ide> this.name = 'CustomWarning'; <ide> this.message = 'A Warning'; <add> this.code = 'CODE001'; <ide> Error.captureStackTrace(this, CustomWarning); <ide> } <ide> util.inherits(CustomWarning, Error); <ide> warningThrowToString.toString = function() { <ide> }; <ide> process.emitWarning(warningThrowToString); <ide> <del>// TypeError is thrown on invalid output <add>// TypeError is thrown on invalid input <ide> assert.throws(() => process.emitWarning(1), TypeError); <ide> assert.throws(() => process.emitWarning({}), TypeError); <add>assert.throws(() => process.emitWarning(true), TypeError); <add>assert.throws(() => process.emitWarning([]), TypeError); <add>assert.throws(() => process.emitWarning('', {}), TypeError); <add>assert.throws(() => process.emitWarning('', '', {}), TypeError); <add>assert.throws(() => process.emitWarning('', 1), TypeError); <add>assert.throws(() => process.emitWarning('', '', 1), TypeError); <add>assert.throws(() => process.emitWarning('', true), TypeError); <add>assert.throws(() => process.emitWarning('', '', true), TypeError); <add>assert.throws(() => process.emitWarning('', []), TypeError); <add>assert.throws(() => process.emitWarning('', '', []), TypeError);
3
Text
Text
tweak the latest changelog descriptions
2e23a3cdbc9f1d3885852a290cb081cd642cfb1e
<ide><path>CHANGELOG.md <ide> - **$compile:** <ide> - bind all directive controllers correctly when using `bindToController` <ide> ([bd7b2177](https://github.com/angular/angular.js/commit/bd7b2177291697a665e4068501b3704200972467), <add> [1c13a4f4](https://github.com/angular/angular.js/commit/1c13a4f45ddc86805a96576b75c969ad577b6274) <ide> [#11343](https://github.com/angular/angular.js/issues/11343), [#11345](https://github.com/angular/angular.js/issues/11345)) <ide> - evaluate against the correct scope with bindToController on new scope <ide> ([50557a6c](https://github.com/angular/angular.js/commit/50557a6cd329e8438fb5694d11e8a7d018142afe), <ide> [#13021](https://github.com/angular/angular.js/issues/13021), [#13025](https://github.com/angular/angular.js/issues/13025)) <del> - bind all directive controllers correctly when using `bindToController` <del> ([1c13a4f4](https://github.com/angular/angular.js/commit/1c13a4f45ddc86805a96576b75c969ad577b6274), <del> [#11343](https://github.com/angular/angular.js/issues/11343), [#11345](https://github.com/angular/angular.js/issues/11345)) <del> - fix scoping of transclusion directives inside replace directive <add> - fix scoping of transclusion directives inside a replace directive <ide> ([1a98c0ee](https://github.com/angular/angular.js/commit/1a98c0ee346b718b9462da1abf4352a4605cbc7f), <ide> [#12975](https://github.com/angular/angular.js/issues/12975), [#12936](https://github.com/angular/angular.js/issues/12936), [#13244](https://github.com/angular/angular.js/issues/13244)) <ide> - use createMap() for $$observe listeners when initialized from attr interpolation <ide> ([4412fe23](https://github.com/angular/angular.js/commit/4412fe238f37f79a2017ee7b20ba089c0acd73e9), <ide> [#12175](https://github.com/angular/angular.js/issues/12175), [#13251](https://github.com/angular/angular.js/issues/13251)) <ide> - **$parse:** <del> - evaluate once simple expressions in interpolations <add> - evaluate simple expressions in interpolations only once <ide> ([1caf0b6b](https://github.com/angular/angular.js/commit/1caf0b6bee5781589e20f7a27a8c60e8b1b784f5), <ide> [#12983](https://github.com/angular/angular.js/issues/12983), [#13002](https://github.com/angular/angular.js/issues/13002)) <ide> - fix typo in error message ("assing" -> "assign") <ide> - block assigning to fields of a constructor <ide> ([e1f4f23f](https://github.com/angular/angular.js/commit/e1f4f23f781a79ae8a4046b21130283cec3f2917), <ide> [#12860](https://github.com/angular/angular.js/issues/12860)) <del> - do not convert to string computed properties multiple times <add> - safer conversion of computed properties to strings <ide> ([20cf7d5e](https://github.com/angular/angular.js/commit/20cf7d5e3a0af766b1929e24794859c79439351c)) <del>- **$resource:** allow XHR request to be cancelled via timeout promise <add>- **$resource:** allow XHR request to be cancelled via a timeout promise <ide> ([4fc73466](https://github.com/angular/angular.js/commit/4fc734665e5dddef26ed30a9d4f75632cd269481), <ide> [#12657](https://github.com/angular/angular.js/issues/12657), [#12675](https://github.com/angular/angular.js/issues/12675), [#10890](https://github.com/angular/angular.js/issues/10890), [#9332](https://github.com/angular/angular.js/issues/9332)) <del>- **$rootScope:** stop IE9 memory leak when destroying scopes <add>- **$rootScope:** prevent IE9 memory leak when destroying scopes <ide> ([8fe781fb](https://github.com/angular/angular.js/commit/8fe781fbe7c42c64eb895c28d9fd5479b037d020), <ide> [#10706](https://github.com/angular/angular.js/issues/10706), [#11786](https://github.com/angular/angular.js/issues/11786)) <ide> - **$sanitize:** <ide> - **filters:** ensure `formatNumber` observes i18n decimal separators <ide> ([658a865c](https://github.com/angular/angular.js/commit/658a865c5b2580eed53b340e7394945cd76e2260), <ide> [#10342](https://github.com/angular/angular.js/issues/10342), [#12850](https://github.com/angular/angular.js/issues/12850)) <del>- **injector:** support arrow functions with no parenthesis <add>- **injector:** support arrow functions with no parentheses <ide> ([03726f7f](https://github.com/angular/angular.js/commit/03726f7fbd5d71c0604b8dd40e97cb2fb0fb777f), <ide> [#12890](https://github.com/angular/angular.js/issues/12890)) <ide> - **input:** remove workaround for Firefox bug <ide> - skip comments and empty options when looking for options <ide> ([395f3ec6](https://github.com/angular/angular.js/commit/395f3ec638f2ee77d22889823aa80898a6ce812d), <ide> [#12190](https://github.com/angular/angular.js/issues/12190), [#13029](https://github.com/angular/angular.js/issues/13029), [#13033](https://github.com/angular/angular.js/issues/13033)) <del> - override select option registration <add> - override select option registration to allow compilation of empty option <ide> ([2fcfd75a](https://github.com/angular/angular.js/commit/2fcfd75a142200e1a4b1b7ed4fb588e3befcbd57), <ide> [#11685](https://github.com/angular/angular.js/issues/11685), [#12972](https://github.com/angular/angular.js/issues/12972), [#12968](https://github.com/angular/angular.js/issues/12968), [#13012](https://github.com/angular/angular.js/issues/13012)) <del> - skip comments when looking for option elements <del> ([7f3f3dd3](https://github.com/angular/angular.js/commit/7f3f3dd3ebcc44711600ac292af54c411c3c705f), <del> [#12190](https://github.com/angular/angular.js/issues/12190)) <ide> - prevent frozen select ui in IE <ide> ([42c97c5d](https://github.com/angular/angular.js/commit/42c97c5db5921e9e5447fb32bdae1f48da42844f), <ide> [#11314](https://github.com/angular/angular.js/issues/11314), [#11795](https://github.com/angular/angular.js/issues/11795)) <ide> - **$templateRequest:** support configuration of $http options <ide> ([b2fc39d2](https://github.com/angular/angular.js/commit/b2fc39d2ddac64249b4f2961ee18b878a1e98251), <ide> [#13188](https://github.com/angular/angular.js/issues/13188), [#11868](https://github.com/angular/angular.js/issues/11868), [#6860](https://github.com/angular/angular.js/issues/6860)) <del>- **$time:** create time service <del> ([fa4c7b7f](https://github.com/angular/angular.js/commit/fa4c7b7f1d885eb9746166e268c9f7511ea39676), <del> [#10402](https://github.com/angular/angular.js/issues/10402), [#10525](https://github.com/angular/angular.js/issues/10525)) <ide> - **Module:** add helper method, `component(...)` for creating component directives <ide> ([54e81655](https://github.com/angular/angular.js/commit/54e816552f20e198e14f849cdb2379fed8570c1a), <ide> [#10007](https://github.com/angular/angular.js/issues/10007), [#12933](https://github.com/angular/angular.js/issues/12933)) <ide> - **$compile:** <ide> - use static jquery data method to avoid creating new instances <ide> ([9b90c32f](https://github.com/angular/angular.js/commit/9b90c32f31fd56e348539674128acec6536cd846)) <del> - Lazily compile the `transclude` function <add> - lazily compile the `transclude` function <ide> ([652b83eb](https://github.com/angular/angular.js/commit/652b83eb226131d131a44453520a569202aa4aac)) <ide> - **$interpolate:** provide a simplified result for constant expressions <ide> ([cf83b4f4](https://github.com/angular/angular.js/commit/cf83b4f445d3a1fc18fc140e65e670754401d50b)) <ide> - **copy:** <del> - avoid regex in isTypedArray <add> - avoid regex in `isTypedArray` <ide> ([c8768d12](https://github.com/angular/angular.js/commit/c8768d12f2f0b31f9ac971aeac6d2c17c9ff3db5)) <del> - only validate/clear user specified destination <add> - only validate/clear if the user specifies a destination <ide> ([33c67ce7](https://github.com/angular/angular.js/commit/33c67ce785cf8be7f0c294b3942ca4a337c5759d), <ide> [#12068](https://github.com/angular/angular.js/issues/12068)) <ide> - **merge:** remove unnecessary wrapping of jqLite element <ide> information on preventing click-hijacking attacks when this option is turned on. <ide> <ide> - **ngMessage:** due to [4971ef12](https://github.com/angular/angular.js/commit/4971ef12d4c2c268cb8d26f90385dc96eba19db8), <ide> <del> <ide> ngMessage is now compiled with a priority of 1, which means directives <ide> on the same element as ngMessage with a priority lower than 1 will <ide> be applied when ngMessage calls the $transclude function. <ide> requirement more strict and alerts the developer explicitly. <ide> <ide> - **orderByFilter:** due to [2a85a634](https://github.com/angular/angular.js/commit/2a85a634f86c84f15b411ce009a3515fca7ba580), <ide> <del>Previously, an non array-like input would pass through the orderBy filter <del>unchanged. <add>Previously, an non array-like input would pass through the orderBy filter unchanged. <ide> Now, an error is thrown. This can be worked around by converting an object <ide> to an array, either manually or using a filter such as <ide> https://github.com/petebacondarwin/angular-toArrayFilter.
1
Text
Text
change property `name` to `firstname`
26853c6273863924d289d8c01927ef18b1eee26c
<ide><path>curriculum/challenges/english/03-front-end-development-libraries/react/create-a-stateful-component.md <ide> You have access to the `state` object throughout the life of your component. You <ide> <ide> # --instructions-- <ide> <del>There is a component in the code editor that is trying to render a `name` property from its `state`. However, there is no `state` defined. Initialize the component with `state` in the `constructor` and assign your name to a property of `name`. <add>There is a component in the code editor that is trying to render a `firstName` property from its `state`. However, there is no `state` defined. Initialize the component with `state` in the `constructor` and assign your name to a property of `firstName`. <ide> <ide> # --hints-- <ide> <ide> assert( <ide> ); <ide> ``` <ide> <del>The state of `StatefulComponent` should be initialized with a property `name` set to a string. <add>The state of `StatefulComponent` should be initialized with a property `firstName` set to a string. <ide> <ide> ```js <ide> assert( <ide> assert( <ide> ); <ide> const initialState = mockedComponent.state(); <ide> return ( <del> typeof initialState === 'object' && typeof initialState.name === 'string' <add> typeof initialState === 'object' && typeof initialState.firstName === 'string' <ide> ); <ide> })() <ide> ); <ide> ``` <ide> <del>The property `name` in the state of `StatefulComponent` should render in the `h1` element. <add>The property `firstName` in the state of `StatefulComponent` should render in the `h1` element. <ide> <ide> ```js <ide> assert( <ide> assert( <ide> React.createElement(StatefulComponent) <ide> ); <ide> const initialState = mockedComponent.state(); <del> return mockedComponent.find('h1').text() === initialState.name; <add> return mockedComponent.find('h1').text() === initialState.firstName; <ide> })() <ide> ); <ide> ``` <ide> class StatefulComponent extends React.Component { <ide> render() { <ide> return ( <ide> <div> <del> <h1>{this.state.name}</h1> <add> <h1>{this.state.firstName}</h1> <ide> </div> <ide> ); <ide> } <ide> class StatefulComponent extends React.Component { <ide> constructor(props) { <ide> super(props); <ide> this.state = { <del> name: 'freeCodeCamp!' <add> firstName: 'freeCodeCamp!' <ide> } <ide> } <ide> render() { <ide> return ( <ide> <div> <del> <h1>{this.state.name}</h1> <add> <h1>{this.state.firstName}</h1> <ide> </div> <ide> ); <ide> }
1
Text
Text
remove snyk badge
da1cd48e823ee5674cb99331d3b5472b403643cb
<ide><path>README.md <ide> [![Build Status](https://travis-ci.org/freeCodeCamp/freeCodeCamp.svg?branch=staging)](https://travis-ci.org/freeCodeCamp/freeCodeCamp) <ide> [![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) <ide> [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/) <del>[![Known Vulnerabilities](https://snyk.io/test/github/freecodecamp/freecodecamp/badge.svg)](https://snyk.io/test/github/freecodecamp/freecodecamp[) <ide> [![Open Source Helpers](https://www.codetriage.com/freecodecamp/freecodecamp/badges/users.svg)](https://www.codetriage.com/freecodecamp/freecodecamp) <ide> <ide> ## Welcome to freeCodeCamp.org's open source codebase and curriculum!
1
Javascript
Javascript
fix modal + flatlist scrolling
8799047dd0bc8dd93f05fa97d4b9a59f7dfeb324
<ide><path>Libraries/Modal/Modal.js <ide> class Modal extends React.Component<Object> { <ide> this._identifier = uniqueModalIdentifier++; <ide> } <ide> <add> static childContextTypes = { <add> virtualizedList: PropTypes.object, <add> }; <add> <add> getChildContext() { <add> // Reset the context so VirtualizedList doesn't get confused by nesting <add> // in the React tree that doesn't reflect the native component heirarchy. <add> return { <add> virtualizedList: null, <add> }; <add> } <add> <ide> componentDidMount() { <ide> if (ModalEventEmitter) { <ide> this._eventSubscription = ModalEventEmitter.addListener(
1
Text
Text
correct some words
b506f8ecdd5ca8adb5d8ad77f085283ee5f584d6
<ide><path>docs/reference/builder.md <ide> FROM ubuntu <ide> RUN echo moo > oink <ide> # Will output something like ===> 695d7793cbe4 <ide> <del># You᾿ll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with <add># You'll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with <ide> # /oink. <ide> ``` <ide><path>docs/reference/commandline/build.md <ide> Successfully built 377c409b35e4 <ide> This sends the URL `http://server/ctx.tar.gz` to the Docker daemon, which <ide> downloads and extracts the referenced tarball. The `-f ctx/Dockerfile` <ide> parameter specifies a path inside `ctx.tar.gz` to the `Dockerfile` that is used <del>to build the image. Any `ADD` commands in that `Dockerfile` that refer to local <add>to build the image. Any `ADD` commands in that `Dockerfile` that refers to local <ide> paths must be relative to the root of the contents inside `ctx.tar.gz`. In the <ide> example above, the tarball contains a directory `ctx/`, so the `ADD <ide> ctx/container.cfg /` operation works as expected. <ide><path>project/ISSUE-TRIAGE.md <ide> reopened when the necessary information is provided. <ide> <ide> ### 2. Classify the Issue <ide> <del>An issue can have multiple of the following labels. Typically, a properly classified issues should <add>An issue can have multiple of the following labels. Typically, a properly classified issue should <ide> have: <ide> <ide> - One label identifying its kind (`kind/*`). <ide> following labels to indicate their degree of priority (from more urgent to less <ide> | priority/P2 | Normal priority: default priority applied. | <ide> | priority/P3 | Best effort: those are nice to have / minor issues. | <ide> <del>And that's it. That should be all the information required for a new or existing contributor to come in an resolve an issue. <add>And that's it. That should be all the information required for a new or existing contributor to come in a resolve an issue. <ide><path>project/PACKAGE-REPO-MAINTENANCE.md <ide> docker run --rm -it --privileged \ <ide> Sh\*t happens. We know. Below are steps to get out of any "hash-sum mismatch" or <ide> "gpg sig error" or the likes error that might happen to the apt repo. <ide> <del>**NOTE:** These are apt repo specific, have had no experimence with anything similar <add>**NOTE:** These are apt repo specific, have had no experience with anything similar <ide> happening to the yum repo in the past so you can rest easy. <ide> <ide> For each step listed below, move on to the next if the previous didn't work.
4
Java
Java
add reactive cors support
e31a2f778bf401f59cb6ae5124bf2d8b70e8606f
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/config/CorsRegistration.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.reactive.config; <add> <add>import java.util.ArrayList; <add>import java.util.Arrays; <add> <add>import org.springframework.http.HttpMethod; <add>import org.springframework.web.bind.annotation.CrossOrigin; <add>import org.springframework.web.cors.CorsConfiguration; <add> <add>/** <add> * {@code CorsRegistration} assists with the creation of a <add> * {@link CorsConfiguration} instance mapped to a path pattern. <add> * <add> * <p>If no path pattern is specified, cross-origin request handling is <add> * mapped to {@code "/**"}. <add> * <add> * <p>By default, all origins, all headers, credentials and {@code GET}, <add> * {@code HEAD}, and {@code POST} methods are allowed, and the max age is <add> * set to 30 minutes. <add> * <add> * @author Sebastien Deleuze <add> * @author Sam Brannen <add> * @since 5.0 <add> * @see CorsConfiguration <add> * @see CorsRegistry <add> */ <add>public class CorsRegistration { <add> <add> private final String pathPattern; <add> <add> private final CorsConfiguration config; <add> <add> <add> public CorsRegistration(String pathPattern) { <add> this.pathPattern = pathPattern; <add> // Same implicit default values as the @CrossOrigin annotation + allows simple methods <add> this.config = new CorsConfiguration(); <add> this.config.setAllowedOrigins(Arrays.asList(CrossOrigin.DEFAULT_ORIGINS)); <add> this.config.setAllowedMethods(Arrays.asList(HttpMethod.GET.name(), <add> HttpMethod.HEAD.name(), HttpMethod.POST.name())); <add> this.config.setAllowedHeaders(Arrays.asList(CrossOrigin.DEFAULT_ALLOWED_HEADERS)); <add> this.config.setAllowCredentials(CrossOrigin.DEFAULT_ALLOW_CREDENTIALS); <add> this.config.setMaxAge(CrossOrigin.DEFAULT_MAX_AGE); <add> } <add> <add> <add> public CorsRegistration allowedOrigins(String... origins) { <add> this.config.setAllowedOrigins(new ArrayList<>(Arrays.asList(origins))); <add> return this; <add> } <add> <add> public CorsRegistration allowedMethods(String... methods) { <add> this.config.setAllowedMethods(new ArrayList<>(Arrays.asList(methods))); <add> return this; <add> } <add> <add> public CorsRegistration allowedHeaders(String... headers) { <add> this.config.setAllowedHeaders(new ArrayList<>(Arrays.asList(headers))); <add> return this; <add> } <add> <add> public CorsRegistration exposedHeaders(String... headers) { <add> this.config.setExposedHeaders(new ArrayList<>(Arrays.asList(headers))); <add> return this; <add> } <add> <add> public CorsRegistration maxAge(long maxAge) { <add> this.config.setMaxAge(maxAge); <add> return this; <add> } <add> <add> public CorsRegistration allowCredentials(boolean allowCredentials) { <add> this.config.setAllowCredentials(allowCredentials); <add> return this; <add> } <add> <add> protected String getPathPattern() { <add> return this.pathPattern; <add> } <add> <add> protected CorsConfiguration getCorsConfiguration() { <add> return this.config; <add> } <add> <add>} <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.reactive.config; <add> <add>import java.util.ArrayList; <add>import java.util.LinkedHashMap; <add>import java.util.List; <add>import java.util.Map; <add> <add>import org.springframework.web.cors.CorsConfiguration; <add> <add>/** <add> * {@code CorsRegistry} assists with the registration of {@link CorsConfiguration} <add> * mapped to a path pattern. <add> * <add> * @author Sebastien Deleuze <add> * @since 5.0 <add> */ <add>public class CorsRegistry { <add> <add> private final List<CorsRegistration> registrations = new ArrayList<>(); <add> <add> <add> /** <add> * Enable cross origin request handling for the specified path pattern. <add> * <add> * <p>Exact path mapping URIs (such as {@code "/admin"}) are supported as <add> * well as Ant-style path patterns (such as {@code "/admin/**"}). <add> * <add> * <p>By default, all origins, all headers, credentials and {@code GET}, <add> * {@code HEAD}, and {@code POST} methods are allowed, and the max age <add> * is set to 30 minutes. <add> */ <add> public CorsRegistration addMapping(String pathPattern) { <add> CorsRegistration registration = new CorsRegistration(pathPattern); <add> this.registrations.add(registration); <add> return registration; <add> } <add> <add> protected Map<String, CorsConfiguration> getCorsConfigurations() { <add> Map<String, CorsConfiguration> configs = new LinkedHashMap<>(this.registrations.size()); <add> for (CorsRegistration registration : this.registrations) { <add> configs.put(registration.getPathPattern(), registration.getCorsConfiguration()); <add> } <add> return configs; <add> } <add>} <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfiguration.java <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.validation.Errors; <ide> import org.springframework.validation.Validator; <add>import org.springframework.web.cors.CorsConfiguration; <ide> import org.springframework.web.reactive.HandlerMapping; <ide> import org.springframework.web.reactive.accept.CompositeContentTypeResolver; <ide> import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder; <ide> public class WebReactiveConfiguration implements ApplicationContextAware { <ide> <ide> private List<HttpMessageWriter<?>> messageWriters; <ide> <add> private Map<String, CorsConfiguration> corsConfigurations; <add> <ide> private ApplicationContext applicationContext; <ide> <ide> <ide> public RequestMappingHandlerMapping requestMappingHandlerMapping() { <ide> RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping(); <ide> mapping.setOrder(0); <ide> mapping.setContentTypeResolver(mvcContentTypeResolver()); <add> mapping.setCorsConfigurations(getCorsConfigurations()); <ide> <ide> PathMatchConfigurer configurer = getPathMatchConfigurer(); <ide> if (configurer.isUseSuffixPatternMatch() != null) { <ide> public ViewResolutionResultHandler viewResolutionResultHandler() { <ide> protected void configureViewResolvers(ViewResolverRegistry registry) { <ide> } <ide> <add> protected final Map<String, CorsConfiguration> getCorsConfigurations() { <add> if (this.corsConfigurations == null) { <add> CorsRegistry registry = new CorsRegistry(); <add> addCorsMappings(registry); <add> this.corsConfigurations = registry.getCorsConfigurations(); <add> } <add> return this.corsConfigurations; <add> } <add> <add> /** <add> * Override this method to configure cross origin requests processing. <add> * @see CorsRegistry <add> */ <add> protected void addCorsMappings(CorsRegistry registry) { <add> } <add> <ide> <ide> private static final class EmptyHandlerMapping extends AbstractHandlerMapping { <ide> <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java <ide> */ <ide> package org.springframework.web.reactive.handler; <ide> <add>import java.util.Map; <add> <add>import reactor.core.publisher.Mono; <add> <ide> import org.springframework.context.support.ApplicationObjectSupport; <ide> import org.springframework.core.Ordered; <ide> import org.springframework.util.AntPathMatcher; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.PathMatcher; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.cors.reactive.CorsConfigurationSource; <add>import org.springframework.web.cors.reactive.CorsProcessor; <add>import org.springframework.web.cors.reactive.CorsUtils; <add>import org.springframework.web.cors.reactive.DefaultCorsProcessor; <add>import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; <ide> import org.springframework.web.reactive.HandlerMapping; <add>import org.springframework.web.server.ServerWebExchange; <add>import org.springframework.web.server.WebHandler; <ide> import org.springframework.web.util.HttpRequestPathHelper; <ide> <ide> /** <ide> public abstract class AbstractHandlerMapping extends ApplicationObjectSupport <ide> <ide> private PathMatcher pathMatcher = new AntPathMatcher(); <ide> <add> protected CorsProcessor corsProcessor = new DefaultCorsProcessor(); <ide> <del> // TODO: CORS <add> protected final UrlBasedCorsConfigurationSource corsConfigSource = new UrlBasedCorsConfigurationSource(); <ide> <ide> /** <ide> * Specify the order value for this HandlerMapping bean. <ide> public HttpRequestPathHelper getPathHelper() { <ide> public void setPathMatcher(PathMatcher pathMatcher) { <ide> Assert.notNull(pathMatcher, "PathMatcher must not be null"); <ide> this.pathMatcher = pathMatcher; <del> // this.corsConfigSource.setPathMatcher(pathMatcher); <add> this.corsConfigSource.setPathMatcher(pathMatcher); <ide> } <ide> <ide> /** <ide> public PathMatcher getPathMatcher() { <ide> return this.pathMatcher; <ide> } <ide> <add> /** <add> * Configure a custom {@link CorsProcessor} to use to apply the matched <add> * {@link CorsConfiguration} for a request. By default {@link DefaultCorsProcessor} is used. <add> */ <add> public void setCorsProcessor(CorsProcessor corsProcessor) { <add> Assert.notNull(corsProcessor, "CorsProcessor must not be null"); <add> this.corsProcessor = corsProcessor; <add> } <add> <add> /** <add> * Return the configured {@link CorsProcessor}. <add> */ <add> public CorsProcessor getCorsProcessor() { <add> return this.corsProcessor; <add> } <add> <add> /** <add> * Set "global" CORS configuration based on URL patterns. By default the first <add> * matching URL pattern is combined with the CORS configuration for the <add> * handler, if any. <add> */ <add> public void setCorsConfigurations(Map<String, CorsConfiguration> corsConfigurations) { <add> this.corsConfigSource.setCorsConfigurations(corsConfigurations); <add> } <add> <add> /** <add> * Get the CORS configuration. <add> */ <add> public Map<String, CorsConfiguration> getCorsConfigurations() { <add> return this.corsConfigSource.getCorsConfigurations(); <add> } <add> <add> protected CorsConfiguration getCorsConfiguration(Object handler, ServerWebExchange exchange) { <add> if (handler != null && handler instanceof CorsConfigurationSource) { <add> return ((CorsConfigurationSource) handler).getCorsConfiguration(exchange); <add> } <add> return null; <add> } <add> <add> protected Object processCorsRequest(ServerWebExchange exchange, Object handler) { <add> if (CorsUtils.isCorsRequest(exchange.getRequest())) { <add> CorsConfiguration globalConfig = this.corsConfigSource.getCorsConfiguration(exchange); <add> CorsConfiguration handlerConfig = getCorsConfiguration(handler, exchange); <add> CorsConfiguration config = (globalConfig != null ? globalConfig.combine(handlerConfig) : handlerConfig); <add> if (!corsProcessor.processRequest(config, exchange) || CorsUtils.isPreFlightRequest(exchange.getRequest())) { <add> return new NoOpHandler(); <add> } <add> } <add> return handler; <add> } <add> <add> private class NoOpHandler implements WebHandler { <add> @Override <add> public Mono<Void> handle(ServerWebExchange exchange) { <add> return Mono.empty(); <add> } <add> } <add> <ide> } <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/AbstractUrlHandlerMapping.java <ide> public Mono<Object> getHandler(ServerWebExchange exchange) { <ide> Object handler = null; <ide> try { <ide> handler = lookupHandler(lookupPath, exchange); <add> handler = processCorsRequest(exchange, handler); <ide> } <ide> catch (Exception ex) { <ide> return Mono.error(ex); <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java <ide> import org.springframework.http.InvalidMediaTypeException; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.web.bind.annotation.RequestMapping; <add>import org.springframework.web.cors.reactive.CorsUtils; <ide> import org.springframework.web.server.ServerWebExchange; <ide> import org.springframework.web.server.UnsupportedMediaTypeStatusException; <ide> <ide> */ <ide> public final class ConsumesRequestCondition extends AbstractRequestCondition<ConsumesRequestCondition> { <ide> <del>// private final static ConsumesRequestCondition PRE_FLIGHT_MATCH = new ConsumesRequestCondition(); <add> private final static ConsumesRequestCondition PRE_FLIGHT_MATCH = new ConsumesRequestCondition(); <ide> <ide> <ide> private final List<ConsumeMediaTypeExpression> expressions; <ide> public ConsumesRequestCondition combine(ConsumesRequestCondition other) { <ide> */ <ide> @Override <ide> public ConsumesRequestCondition getMatchingCondition(ServerWebExchange exchange) { <del>// if (CorsUtils.isPreFlightRequest(request)) { <del>// return PRE_FLIGHT_MATCH; <del>// } <add> if (CorsUtils.isPreFlightRequest(exchange.getRequest())) { <add> return PRE_FLIGHT_MATCH; <add> } <ide> if (isEmpty()) { <ide> return this; <ide> } <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/HeadersRequestCondition.java <ide> import java.util.Set; <ide> <ide> import org.springframework.web.bind.annotation.RequestMapping; <add>import org.springframework.web.cors.reactive.CorsUtils; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> /** <ide> */ <ide> public final class HeadersRequestCondition extends AbstractRequestCondition<HeadersRequestCondition> { <ide> <del>// private final static HeadersRequestCondition PRE_FLIGHT_MATCH = new HeadersRequestCondition(); <add> private final static HeadersRequestCondition PRE_FLIGHT_MATCH = new HeadersRequestCondition(); <ide> <ide> <ide> private final Set<HeaderExpression> expressions; <ide> public HeadersRequestCondition combine(HeadersRequestCondition other) { <ide> */ <ide> @Override <ide> public HeadersRequestCondition getMatchingCondition(ServerWebExchange exchange) { <del>// if (CorsUtils.isPreFlightRequest(request)) { <del>// return PRE_FLIGHT_MATCH; <del>// } <add> if (CorsUtils.isPreFlightRequest(exchange.getRequest())) { <add> return PRE_FLIGHT_MATCH; <add> } <ide> for (HeaderExpression expression : expressions) { <ide> if (!expression.match(exchange)) { <ide> return null; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java <ide> import org.springframework.http.MediaType; <ide> import org.springframework.web.accept.ContentNegotiationManager; <ide> import org.springframework.web.bind.annotation.RequestMapping; <add>import org.springframework.web.cors.reactive.CorsUtils; <ide> import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder; <ide> import org.springframework.web.reactive.accept.RequestedContentTypeResolver; <ide> import org.springframework.web.reactive.accept.HeaderContentTypeResolver; <ide> */ <ide> public final class ProducesRequestCondition extends AbstractRequestCondition<ProducesRequestCondition> { <ide> <del>// private final static ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition(); <add> private final static ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition(); <ide> <ide> <ide> private final List<ProduceMediaTypeExpression> MEDIA_TYPE_ALL_LIST = <ide> public ProducesRequestCondition combine(ProducesRequestCondition other) { <ide> */ <ide> @Override <ide> public ProducesRequestCondition getMatchingCondition(ServerWebExchange exchange) { <del>// if (CorsUtils.isPreFlightRequest(request)) { <del>// return PRE_FLIGHT_MATCH; <del>// } <add> if (CorsUtils.isPreFlightRequest(exchange.getRequest())) { <add> return PRE_FLIGHT_MATCH; <add> } <ide> if (isEmpty()) { <ide> return this; <ide> } <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/RequestMethodsRequestCondition.java <ide> import java.util.LinkedHashSet; <ide> import java.util.List; <ide> import java.util.Set; <del>import javax.servlet.http.HttpServletRequest; <ide> <del>import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.HttpMethod; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <ide> import org.springframework.web.bind.annotation.RequestMethod; <add>import org.springframework.web.cors.reactive.CorsUtils; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> /** <ide> public RequestMethodsRequestCondition combine(RequestMethodsRequestCondition oth <ide> */ <ide> @Override <ide> public RequestMethodsRequestCondition getMatchingCondition(ServerWebExchange exchange) { <del>// if (CorsUtils.isPreFlightRequest(request)) { <del>// return matchPreFlight(request); <del>// } <add> if (CorsUtils.isPreFlightRequest(exchange.getRequest())) { <add> return matchPreFlight(exchange.getRequest()); <add> } <ide> if (getMethods().isEmpty()) { <ide> if (RequestMethod.OPTIONS.name().equals(exchange.getRequest().getMethod().name())) { <ide> return null; // No implicit match for OPTIONS (we handle it) <ide> public RequestMethodsRequestCondition getMatchingCondition(ServerWebExchange exc <ide> * Hence empty conditions is a match, otherwise try to match to the HTTP <ide> * method in the "Access-Control-Request-Method" header. <ide> */ <del> @SuppressWarnings("unused") <del> private RequestMethodsRequestCondition matchPreFlight(HttpServletRequest request) { <add> private RequestMethodsRequestCondition matchPreFlight(ServerHttpRequest request) { <ide> if (getMethods().isEmpty()) { <ide> return this; <ide> } <del> String expectedMethod = request.getHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD); <del> return matchRequestMethod(expectedMethod); <add> HttpMethod expectedMethod = request.getHeaders().getAccessControlRequestMethod(); <add> return matchRequestMethod(expectedMethod.name()); <ide> } <ide> <ide> private RequestMethodsRequestCondition matchRequestMethod(String httpMethodValue) { <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java <ide> import java.util.List; <ide> import java.util.Map; <ide> import java.util.Set; <add>import java.util.concurrent.ConcurrentHashMap; <ide> import java.util.concurrent.locks.ReentrantReadWriteLock; <ide> <add>import javax.servlet.http.HttpServletRequest; <add> <ide> import reactor.core.publisher.Mono; <ide> <ide> import org.springframework.aop.support.AopUtils; <ide> import org.springframework.beans.factory.InitializingBean; <ide> import org.springframework.core.MethodIntrospector; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.util.LinkedMultiValueMap; <ide> import org.springframework.util.MultiValueMap; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.cors.reactive.CorsUtils; <ide> import org.springframework.web.method.HandlerMethod; <ide> import org.springframework.web.reactive.HandlerMapping; <ide> import org.springframework.web.reactive.handler.AbstractHandlerMapping; <ide> */ <ide> private static final String SCOPED_TARGET_NAME_PREFIX = "scopedTarget."; <ide> <add> private static final HandlerMethod PREFLIGHT_AMBIGUOUS_MATCH = <add> new HandlerMethod(new EmptyHandler(), ClassUtils.getMethod(EmptyHandler.class, "handle")); <add> <add> private static final CorsConfiguration ALLOW_CORS_CONFIG = new CorsConfiguration(); <add> <add> static { <add> ALLOW_CORS_CONFIG.addAllowedOrigin("*"); <add> ALLOW_CORS_CONFIG.addAllowedMethod("*"); <add> ALLOW_CORS_CONFIG.addAllowedHeader("*"); <add> ALLOW_CORS_CONFIG.setAllowCredentials(true); <add> } <add> <ide> <ide> private final MappingRegistry mappingRegistry = new MappingRegistry(); <ide> <ide> protected HandlerMethod createHandlerMethod(Object handler, Method method) { <ide> return handlerMethod; <ide> } <ide> <add> /** <add> * Extract and return the CORS configuration for the mapping. <add> */ <add> protected CorsConfiguration initCorsConfiguration(Object handler, Method method, T mapping) { <add> return null; <add> } <add> <ide> /** <ide> * Invoked after all handler methods have been detected. <ide> * @param handlerMethods a read-only map with handler methods and mappings. <ide> public Mono<Object> getHandler(ServerWebExchange exchange) { <ide> logger.debug("Did not find handler method for [" + lookupPath + "]"); <ide> } <ide> } <del> return (handlerMethod != null ? Mono.just(handlerMethod.createWithResolvedBean()) : Mono.empty()); <add> if (handlerMethod != null) { <add> handlerMethod = handlerMethod.createWithResolvedBean(); <add> } <add> return Mono.justOrEmpty(processCorsRequest(exchange, handlerMethod)); <ide> } <ide> finally { <ide> this.mappingRegistry.releaseReadLock(); <ide> protected HandlerMethod lookupHandlerMethod(String lookupPath, ServerWebExchange <ide> } <ide> Match bestMatch = matches.get(0); <ide> if (matches.size() > 1) { <add> if (CorsUtils.isPreFlightRequest(exchange.getRequest())) { <add> return PREFLIGHT_AMBIGUOUS_MATCH; <add> } <ide> Match secondBestMatch = matches.get(1); <ide> if (comparator.compare(bestMatch, secondBestMatch) == 0) { <ide> Method m1 = bestMatch.handlerMethod.getMethod(); <ide> protected HandlerMethod handleNoMatch(Set<T> mappings, String lookupPath, Server <ide> return null; <ide> } <ide> <add> @Override <add> protected CorsConfiguration getCorsConfiguration(Object handler, ServerWebExchange exchange) { <add> CorsConfiguration corsConfig = super.getCorsConfiguration(handler, exchange); <add> if (handler instanceof HandlerMethod) { <add> HandlerMethod handlerMethod = (HandlerMethod) handler; <add> if (handlerMethod.equals(PREFLIGHT_AMBIGUOUS_MATCH)) { <add> return AbstractHandlerMethodMapping.ALLOW_CORS_CONFIG; <add> } <add> else { <add> CorsConfiguration corsConfigFromMethod = this.mappingRegistry.getCorsConfiguration(handlerMethod); <add> corsConfig = (corsConfig != null ? corsConfig.combine(corsConfigFromMethod) : corsConfigFromMethod); <add> } <add> } <add> return corsConfig; <add> } <add> <ide> <ide> // Abstract template methods <ide> <ide> class MappingRegistry { <ide> <ide> private final MultiValueMap<String, T> urlLookup = new LinkedMultiValueMap<>(); <ide> <add> private final Map<HandlerMethod, CorsConfiguration> corsLookup = <add> new ConcurrentHashMap<>(); <add> <ide> private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); <ide> <ide> /** <ide> public List<T> getMappingsByUrl(String urlPath) { <ide> return this.urlLookup.get(urlPath); <ide> } <ide> <add> /** <add> * Return CORS configuration. Thread-safe for concurrent use. <add> */ <add> public CorsConfiguration getCorsConfiguration(HandlerMethod handlerMethod) { <add> HandlerMethod original = handlerMethod.getResolvedFromHandlerMethod(); <add> return this.corsLookup.get(original != null ? original : handlerMethod); <add> } <add> <ide> /** <ide> * Acquire the read lock when using getMappings and getMappingsByUrl. <ide> */ <ide> public void register(T mapping, Object handler, Method method) { <ide> this.urlLookup.add(url, mapping); <ide> } <ide> <add> CorsConfiguration corsConfig = initCorsConfiguration(handler, method, mapping); <add> if (corsConfig != null) { <add> this.corsLookup.put(handlerMethod, corsConfig); <add> } <add> <ide> this.registry.put(mapping, new MappingRegistration<>(mapping, handlerMethod, directUrls)); <ide> } <ide> finally { <ide> public void unregister(T mapping) { <ide> } <ide> } <ide> } <add> this.corsLookup.remove(definition.getHandlerMethod()); <ide> } <ide> finally { <ide> this.readWriteLock.writeLock().unlock(); <ide> public int compare(Match match1, Match match2) { <ide> } <ide> } <ide> <add> private static class EmptyHandler { <add> <add> public void handle() { <add> throw new UnsupportedOperationException("not implemented"); <add> } <add> } <add> <ide> } <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java <ide> <ide> import java.lang.reflect.AnnotatedElement; <ide> import java.lang.reflect.Method; <add>import java.util.Arrays; <ide> import java.util.Set; <ide> <ide> import org.springframework.context.EmbeddedValueResolverAware; <ide> import org.springframework.core.annotation.AnnotatedElementUtils; <ide> import org.springframework.stereotype.Controller; <ide> import org.springframework.util.Assert; <add>import org.springframework.util.CollectionUtils; <ide> import org.springframework.util.StringValueResolver; <add>import org.springframework.web.bind.annotation.CrossOrigin; <ide> import org.springframework.web.bind.annotation.RequestMapping; <add>import org.springframework.web.bind.annotation.RequestMethod; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.method.HandlerMethod; <ide> import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder; <ide> import org.springframework.web.reactive.accept.RequestedContentTypeResolver; <ide> import org.springframework.web.reactive.result.condition.RequestCondition; <ide> protected String[] resolveEmbeddedValuesInPatterns(String[] patterns) { <ide> } <ide> } <ide> <add> @Override <add> protected CorsConfiguration initCorsConfiguration(Object handler, Method method, RequestMappingInfo mappingInfo) { <add> HandlerMethod handlerMethod = createHandlerMethod(handler, method); <add> CrossOrigin typeAnnotation = AnnotatedElementUtils.findMergedAnnotation(handlerMethod.getBeanType(), CrossOrigin.class); <add> CrossOrigin methodAnnotation = AnnotatedElementUtils.findMergedAnnotation(method, CrossOrigin.class); <add> <add> if (typeAnnotation == null && methodAnnotation == null) { <add> return null; <add> } <add> <add> CorsConfiguration config = new CorsConfiguration(); <add> updateCorsConfig(config, typeAnnotation); <add> updateCorsConfig(config, methodAnnotation); <add> <add> if (CollectionUtils.isEmpty(config.getAllowedOrigins())) { <add> config.setAllowedOrigins(Arrays.asList(CrossOrigin.DEFAULT_ORIGINS)); <add> } <add> if (CollectionUtils.isEmpty(config.getAllowedMethods())) { <add> for (RequestMethod allowedMethod : mappingInfo.getMethodsCondition().getMethods()) { <add> config.addAllowedMethod(allowedMethod.name()); <add> } <add> } <add> if (CollectionUtils.isEmpty(config.getAllowedHeaders())) { <add> config.setAllowedHeaders(Arrays.asList(CrossOrigin.DEFAULT_ALLOWED_HEADERS)); <add> } <add> if (config.getAllowCredentials() == null) { <add> config.setAllowCredentials(CrossOrigin.DEFAULT_ALLOW_CREDENTIALS); <add> } <add> if (config.getMaxAge() == null) { <add> config.setMaxAge(CrossOrigin.DEFAULT_MAX_AGE); <add> } <add> return config; <add> } <add> <add> private void updateCorsConfig(CorsConfiguration config, CrossOrigin annotation) { <add> if (annotation == null) { <add> return; <add> } <add> for (String origin : annotation.origins()) { <add> config.addAllowedOrigin(resolveCorsAnnotationValue(origin)); <add> } <add> for (RequestMethod method : annotation.methods()) { <add> config.addAllowedMethod(method.name()); <add> } <add> for (String header : annotation.allowedHeaders()) { <add> config.addAllowedHeader(resolveCorsAnnotationValue(header)); <add> } <add> for (String header : annotation.exposedHeaders()) { <add> config.addExposedHeader(resolveCorsAnnotationValue(header)); <add> } <add> <add> String allowCredentials = resolveCorsAnnotationValue(annotation.allowCredentials()); <add> if ("true".equalsIgnoreCase(allowCredentials)) { <add> config.setAllowCredentials(true); <add> } <add> else if ("false".equalsIgnoreCase(allowCredentials)) { <add> config.setAllowCredentials(false); <add> } <add> else if (!allowCredentials.isEmpty()) { <add> throw new IllegalStateException("@CrossOrigin's allowCredentials value must be \"true\", \"false\", " + <add> "or an empty string (\"\"): current value is [" + allowCredentials + "]"); <add> } <add> <add> if (annotation.maxAge() >= 0 && config.getMaxAge() == null) { <add> config.setMaxAge(annotation.maxAge()); <add> } <add> } <add> <add> private String resolveCorsAnnotationValue(String value) { <add> return (this.embeddedValueResolver != null ? this.embeddedValueResolver.resolveStringValue(value) : value); <add> } <add> <ide> } <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/config/CorsRegistryTests.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.reactive.config; <add> <add>import java.util.Arrays; <add>import java.util.Map; <add> <add>import static org.junit.Assert.assertEquals; <add>import static org.junit.Assert.assertTrue; <add>import org.junit.Before; <add>import org.junit.Test; <add> <add>import org.springframework.web.cors.CorsConfiguration; <add> <add>/** <add> * Test fixture with a {@link CorsRegistry}. <add> * <add> * @author Sebastien Deleuze <add> */ <add>public class CorsRegistryTests { <add> <add> private CorsRegistry registry; <add> <add> @Before <add> public void setUp() { <add> this.registry = new CorsRegistry(); <add> } <add> <add> @Test <add> public void noMapping() { <add> assertTrue(this.registry.getCorsConfigurations().isEmpty()); <add> } <add> <add> @Test <add> public void multipleMappings() { <add> this.registry.addMapping("/foo"); <add> this.registry.addMapping("/bar"); <add> assertEquals(2, this.registry.getCorsConfigurations().size()); <add> } <add> <add> @Test <add> public void customizedMapping() { <add> this.registry.addMapping("/foo").allowedOrigins("http://domain2.com", "http://domain2.com") <add> .allowedMethods("DELETE").allowCredentials(false).allowedHeaders("header1", "header2") <add> .exposedHeaders("header3", "header4").maxAge(3600); <add> Map<String, CorsConfiguration> configs = this.registry.getCorsConfigurations(); <add> assertEquals(1, configs.size()); <add> CorsConfiguration config = configs.get("/foo"); <add> assertEquals(Arrays.asList("http://domain2.com", "http://domain2.com"), config.getAllowedOrigins()); <add> assertEquals(Arrays.asList("DELETE"), config.getAllowedMethods()); <add> assertEquals(Arrays.asList("header1", "header2"), config.getAllowedHeaders()); <add> assertEquals(Arrays.asList("header3", "header4"), config.getExposedHeaders()); <add> assertEquals(false, config.getAllowCredentials()); <add> assertEquals(Long.valueOf(3600), config.getMaxAge()); <add> } <add> <add>} <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/CorsAbstractUrlHandlerMappingTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.web.reactive.handler; <add> <add>import java.net.URISyntaxException; <add>import java.util.Collections; <add> <add>import static org.junit.Assert.*; <add>import static org.junit.Assert.assertSame; <add>import org.junit.Before; <add>import org.junit.Test; <add> <add>import org.springframework.context.annotation.AnnotationConfigApplicationContext; <add>import org.springframework.context.annotation.Bean; <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.cors.reactive.CorsConfigurationSource; <add>import org.springframework.web.server.ServerWebExchange; <add>import org.springframework.web.server.adapter.DefaultServerWebExchange; <add>import org.springframework.web.server.session.MockWebSessionManager; <add>import org.springframework.web.server.session.WebSessionManager; <add> <add>/** <add> * Unit tests for CORS support at {@link AbstractUrlHandlerMapping} level. <add> * <add> * @author Sebastien Deleuze <add> * @author Rossen Stoyanchev <add> */ <add>public class CorsAbstractUrlHandlerMappingTests { <add> <add> private AnnotationConfigApplicationContext wac; <add> <add> private TestUrlHandlerMapping handlerMapping; <add> <add> private Object mainController; <add> <add> private CorsAwareHandler corsConfigurationSourceController; <add> <add> @Before <add> public void setup() { <add> wac = new AnnotationConfigApplicationContext(); <add> wac.register(WebConfig.class); <add> wac.refresh(); <add> <add> handlerMapping = (TestUrlHandlerMapping) wac.getBean("handlerMapping"); <add> mainController = wac.getBean("mainController"); <add> corsConfigurationSourceController = (CorsAwareHandler) wac.getBean("corsConfigurationSourceController"); <add> } <add> <add> @Test <add> public void actualRequestWithoutCorsConfigurationProvider() throws Exception { <add> ServerWebExchange exchange = createExchange(HttpMethod.GET, "/welcome.html", "http://domain2.com", "GET"); <add> Object actual = handlerMapping.getHandler(exchange).block(); <add> assertNotNull(actual); <add> assertSame(mainController, actual); <add> } <add> <add> @Test <add> public void preflightRequestWithoutCorsConfigurationProvider() throws Exception { <add> ServerWebExchange exchange = createExchange(HttpMethod.OPTIONS, "/welcome.html", "http://domain2.com", "GET"); <add> Object actual = handlerMapping.getHandler(exchange).block(); <add> assertNotNull(actual); <add> assertEquals("NoOpHandler", actual.getClass().getSimpleName()); <add> assertNull(exchange.getResponse().getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> } <add> <add> @Test <add> public void actualRequestWithCorsConfigurationProvider() throws Exception { <add> ServerWebExchange exchange = createExchange(HttpMethod.GET, "/cors.html", "http://domain2.com", "GET"); <add> Object actual = handlerMapping.getHandler(exchange).block(); <add> assertNotNull(actual); <add> assertSame(corsConfigurationSourceController, actual); <add> CorsConfiguration config = ((CorsConfigurationSource)actual).getCorsConfiguration(createExchange(HttpMethod.GET, "", "","")); <add> assertNotNull(config); <add> assertArrayEquals(config.getAllowedOrigins().toArray(), new String[]{"*"}); <add> assertEquals("*", exchange.getResponse().getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> } <add> <add> @Test <add> public void preflightRequestWithCorsConfigurationProvider() throws Exception { <add> ServerWebExchange exchange = createExchange(HttpMethod.OPTIONS, "/cors.html", "http://domain2.com", "GET"); <add> Object actual = handlerMapping.getHandler(exchange).block(); <add> assertNotNull(actual); <add> assertEquals("NoOpHandler", actual.getClass().getSimpleName()); <add> assertEquals("*", exchange.getResponse().getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> } <add> <add> @Test <add> public void actualRequestWithMappedCorsConfiguration() throws Exception { <add> CorsConfiguration mappedConfig = new CorsConfiguration(); <add> mappedConfig.addAllowedOrigin("*"); <add> this.handlerMapping.setCorsConfigurations(Collections.singletonMap("/welcome.html", mappedConfig)); <add> <add> ServerWebExchange exchange = createExchange(HttpMethod.GET, "/welcome.html", "http://domain2.com", "GET"); <add> Object actual = handlerMapping.getHandler(exchange).block(); <add> assertNotNull(actual); <add> assertSame(mainController, actual); <add> assertEquals("*", exchange.getResponse().getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> } <add> <add> @Test <add> public void preflightRequestWithMappedCorsConfiguration() throws Exception { <add> CorsConfiguration mappedConfig = new CorsConfiguration(); <add> mappedConfig.addAllowedOrigin("*"); <add> this.handlerMapping.setCorsConfigurations(Collections.singletonMap("/welcome.html", mappedConfig)); <add> <add> ServerWebExchange exchange = createExchange(HttpMethod.OPTIONS, "/welcome.html", "http://domain2.com", "GET"); <add> Object actual = handlerMapping.getHandler(exchange).block(); <add> assertNotNull(actual); <add> assertEquals("NoOpHandler", actual.getClass().getSimpleName()); <add> assertEquals("*", exchange.getResponse().getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> } <add> <add> <add> private ServerWebExchange createExchange(HttpMethod method, String path, String origin, <add> String accessControlRequestMethod) throws URISyntaxException { <add> <add> ServerHttpRequest request = new MockServerHttpRequest(method, "http://localhost" + path); <add> request.getHeaders().add(HttpHeaders.ORIGIN, origin); <add> request.getHeaders().add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, accessControlRequestMethod); <add> WebSessionManager sessionManager = new MockWebSessionManager(); <add> return new DefaultServerWebExchange(request, new MockServerHttpResponse(), sessionManager); <add> } <add> <add> <add> @Configuration <add> static class WebConfig { <add> <add> @Bean @SuppressWarnings("unused") <add> public TestUrlHandlerMapping handlerMapping() { <add> TestUrlHandlerMapping hm = new TestUrlHandlerMapping(); <add> hm.setUseTrailingSlashMatch(true); <add> hm.registerHandler("/welcome.html", mainController()); <add> hm.registerHandler("/cors.html", corsConfigurationSourceController()); <add> return hm; <add> } <add> <add> @Bean <add> public Object mainController() { <add> return new Object(); <add> } <add> <add> @Bean <add> public CorsAwareHandler corsConfigurationSourceController() { <add> return new CorsAwareHandler(); <add> } <add> <add> } <add> <add> static class TestUrlHandlerMapping extends AbstractUrlHandlerMapping { <add> <add> } <add> <add> static class CorsAwareHandler implements CorsConfigurationSource { <add> <add> @Override <add> public CorsConfiguration getCorsConfiguration(ServerWebExchange exchange) { <add> CorsConfiguration config = new CorsConfiguration(); <add> config.addAllowedOrigin("*"); <add> return config; <add> } <add> } <add> <add>} <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/AbstractRequestMappingIntegrationTests.java <ide> import org.springframework.web.client.RestTemplate; <ide> import org.springframework.web.reactive.DispatcherHandler; <ide> import org.springframework.web.server.adapter.WebHttpHandlerBuilder; <add>import org.springframework.web.server.handler.ResponseStatusExceptionHandler; <ide> <ide> import static org.springframework.http.RequestEntity.get; <ide> <ide> protected HttpHandler createHttpHandler() { <ide> this.applicationContext = initApplicationContext(); <ide> return WebHttpHandlerBuilder <ide> .webHandler(new DispatcherHandler(this.applicationContext)) <add> .exceptionHandlers(new ResponseStatusExceptionHandler()) <ide> .build(); <ide> } <ide> <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CorsConfigurationIntegrationTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.reactive.result.method.annotation; <add> <add>import static org.junit.Assert.*; <add>import org.junit.Test; <add> <add>import org.springframework.context.ApplicationContext; <add>import org.springframework.context.annotation.AnnotationConfigApplicationContext; <add>import org.springframework.context.annotation.ComponentScan; <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.http.HttpEntity; <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.HttpStatus; <add>import org.springframework.http.ResponseEntity; <add>import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; <add>import org.springframework.web.bind.annotation.GetMapping; <add>import org.springframework.web.bind.annotation.RestController; <add>import org.springframework.web.client.HttpClientErrorException; <add>import org.springframework.web.client.RestTemplate; <add>import org.springframework.web.reactive.config.CorsRegistry; <add>import org.springframework.web.reactive.config.WebReactiveConfiguration; <add> <add>/** <add> * @author Sebastien Deleuze <add> */ <add>public class CorsConfigurationIntegrationTests extends AbstractRequestMappingIntegrationTests { <add> <add> // JDK default HTTP client blacklist headers like Origin <add> private RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); <add> <add> @Override <add> protected ApplicationContext initApplicationContext() { <add> AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); <add> wac.register(WebConfig.class); <add> wac.refresh(); <add> return wac; <add> } <add> <add> @Override <add> RestTemplate getRestTemplate() { <add> return this.restTemplate; <add> } <add> <add> @Test <add> public void actualRequestWithCorsEnabled() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://localhost:9000"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/cors"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://localhost:9000", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("cors", entity.getBody()); <add> } <add> <add> @Test <add> public void actualRequestWithCorsRejected() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://localhost:9000"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> try { <add> this.restTemplate.exchange(getUrl("/cors-restricted"), HttpMethod.GET, <add> requestEntity, String.class); <add> } <add> catch (HttpClientErrorException e) { <add> assertEquals(HttpStatus.FORBIDDEN, e.getStatusCode()); <add> return; <add> } <add> fail(); <add> } <add> <add> @Test <add> public void actualRequestWithoutCorsEnabled() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://localhost:9000"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/welcome"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertNull(entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("welcome", entity.getBody()); <add> } <add> <add> @Test <add> public void preflightRequestWithCorsEnabled() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://localhost:9000"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/cors"), <add> HttpMethod.OPTIONS, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://localhost:9000", entity.getHeaders().getAccessControlAllowOrigin()); <add> } <add> <add> @Test <add> public void preflightRequestWithCorsRejected() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://localhost:9000"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> try { <add> this.restTemplate.exchange(getUrl("/cors-restricted"), HttpMethod.OPTIONS, <add> requestEntity, String.class); <add> } <add> catch (HttpClientErrorException e) { <add> assertEquals(HttpStatus.FORBIDDEN, e.getStatusCode()); <add> return; <add> } <add> fail(); <add> } <add> <add> @Test <add> public void preflightRequestWithoutCorsEnabled() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://localhost:9000"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> try { <add> this.restTemplate.exchange(getUrl("/welcome"), HttpMethod.OPTIONS, <add> requestEntity, String.class); <add> } <add> catch (HttpClientErrorException e) { <add> assertEquals(HttpStatus.FORBIDDEN, e.getStatusCode()); <add> return; <add> } <add> fail(); <add> } <add> <add> private String getUrl(String path) { <add> return "http://localhost:" + this.port + path; <add> } <add> <add> <add> @Configuration <add> @ComponentScan(resourcePattern = "**/CorsConfigurationIntegrationTests*.class") <add> @SuppressWarnings({"unused", "WeakerAccess"}) <add> static class WebConfig extends WebReactiveConfiguration { <add> <add> @Override <add> protected void addCorsMappings(CorsRegistry registry) { <add> registry.addMapping("/cors-restricted").allowedOrigins("http://foo"); <add> registry.addMapping("/cors"); <add> } <add> } <add> <add> @RestController <add> static class TestController { <add> <add> @GetMapping("/welcome") <add> public String welcome() { <add> return "welcome"; <add> } <add> <add> @GetMapping("/cors") <add> public String cors() { <add> return "cors"; <add> } <add> <add> @GetMapping("/cors-restricted") <add> public String corsRestricted() { <add> return "corsRestricted"; <add> } <add> <add> } <add> <add>} <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CrossOriginAnnotationIntegrationTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.reactive.result.method.annotation; <add> <add>import java.util.Properties; <add> <add>import static org.junit.Assert.*; <add>import static org.junit.Assert.assertArrayEquals; <add>import org.junit.Test; <add> <add>import org.springframework.context.ApplicationContext; <add>import org.springframework.context.annotation.AnnotationConfigApplicationContext; <add>import org.springframework.context.annotation.ComponentScan; <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; <add>import org.springframework.core.env.PropertiesPropertySource; <add>import org.springframework.http.HttpEntity; <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.HttpStatus; <add>import org.springframework.http.ResponseEntity; <add>import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; <add>import org.springframework.web.bind.annotation.CrossOrigin; <add>import org.springframework.web.bind.annotation.RequestMapping; <add>import org.springframework.web.bind.annotation.RequestMethod; <add>import org.springframework.web.bind.annotation.RestController; <add>import org.springframework.web.client.RestTemplate; <add>import org.springframework.web.reactive.config.WebReactiveConfiguration; <add> <add>/** <add> * @author Sebastien Deleuze <add> */ <add>public class CrossOriginAnnotationIntegrationTests extends AbstractRequestMappingIntegrationTests { <add> <add> // JDK default HTTP client blacklist headers like Origin <add> private RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); <add> <add> <add> @Override <add> protected ApplicationContext initApplicationContext() { <add> AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); <add> wac.register(WebConfig.class); <add> Properties props = new Properties(); <add> props.setProperty("myOrigin", "http://site1.com"); <add> wac.getEnvironment().getPropertySources().addFirst(new PropertiesPropertySource("ps", props)); <add> wac.register(PropertySourcesPlaceholderConfigurer.class); <add> wac.refresh(); <add> return wac; <add> } <add> <add> @Override <add> RestTemplate getRestTemplate() { <add> return this.restTemplate; <add> } <add> <add> @Test <add> public void actualGetRequestWithoutAnnotation() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/no"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertNull(entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("no", entity.getBody()); <add> } <add> <add> @Test <add> public void actualPostRequestWithoutAnnotation() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/no"), <add> HttpMethod.POST, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertNull(entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("no-post", entity.getBody()); <add> } <add> <add> @Test <add> public void actualRequestWithDefaultAnnotation() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/default"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals(true, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertEquals("default", entity.getBody()); <add> } <add> <add> @Test <add> public void preflightRequestWithDefaultAnnotation() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<Void> entity = this.restTemplate.exchange(getUrl("/default"), <add> HttpMethod.OPTIONS, requestEntity, Void.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals(1800, entity.getHeaders().getAccessControlMaxAge()); <add> assertEquals(true, entity.getHeaders().getAccessControlAllowCredentials()); <add> } <add> <add> @Test <add> public void actualRequestWithDefaultAnnotationAndNoOrigin() { <add> HttpHeaders headers = new HttpHeaders(); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/default"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertNull(entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("default", entity.getBody()); <add> } <add> <add> @Test <add> public void actualRequestWithCustomizedAnnotation() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/customized"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals(false, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertEquals(-1, entity.getHeaders().getAccessControlMaxAge()); <add> assertEquals("customized", entity.getBody()); <add> } <add> <add> @Test <add> public void preflightRequestWithCustomizedAnnotation() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "header1, header2"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/customized"), <add> HttpMethod.OPTIONS, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertArrayEquals(new HttpMethod[] {HttpMethod.GET}, entity.getHeaders().getAccessControlAllowMethods().toArray()); <add> assertEquals(false, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertArrayEquals(new String[] {"header1", "header2"}, entity.getHeaders().getAccessControlAllowHeaders().toArray()); <add> assertArrayEquals(new String[] {"header3", "header4"}, entity.getHeaders().getAccessControlExposeHeaders().toArray()); <add> assertEquals(123, entity.getHeaders().getAccessControlMaxAge()); <add> } <add> <add> @Test <add> public void customOriginDefinedViaValueAttribute() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/origin-value-attribute"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("value-attribute", entity.getBody()); <add> } <add> <add> @Test <add> public void customOriginDefinedViaPlaceholder() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/origin-placeholder"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals("placeholder", entity.getBody()); <add> } <add> <add> @Test <add> public void classLevel() { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/foo"), <add> HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("*", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals(false, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertEquals("foo", entity.getBody()); <add> <add> entity = this.restTemplate.exchange(getUrl("/bar"), HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("*", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals(false, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertEquals("bar", entity.getBody()); <add> <add> entity = this.restTemplate.exchange(getUrl("/baz"), HttpMethod.GET, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertEquals(true, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertEquals("baz", entity.getBody()); <add> } <add> <add> @Test <add> public void ambiguousHeaderPreflightRequest() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "header1"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/ambiguous-header"), <add> HttpMethod.OPTIONS, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertArrayEquals(new HttpMethod[] {HttpMethod.GET}, entity.getHeaders().getAccessControlAllowMethods().toArray()); <add> assertEquals(true, entity.getHeaders().getAccessControlAllowCredentials()); <add> assertArrayEquals(new String[] {"header1"}, entity.getHeaders().getAccessControlAllowHeaders().toArray()); <add> } <add> <add> @Test <add> public void ambiguousProducesPreflightRequest() throws Exception { <add> HttpHeaders headers = new HttpHeaders(); <add> headers.add(HttpHeaders.ORIGIN, "http://site1.com"); <add> headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> HttpEntity<?> requestEntity = new HttpEntity(headers); <add> ResponseEntity<String> entity = this.restTemplate.exchange(getUrl("/ambiguous-produces"), <add> HttpMethod.OPTIONS, requestEntity, String.class); <add> assertEquals(HttpStatus.OK, entity.getStatusCode()); <add> assertEquals("http://site1.com", entity.getHeaders().getAccessControlAllowOrigin()); <add> assertArrayEquals(new HttpMethod[] {HttpMethod.GET}, entity.getHeaders().getAccessControlAllowMethods().toArray()); <add> assertEquals(true, entity.getHeaders().getAccessControlAllowCredentials()); <add> } <add> <add> private String getUrl(String path) { <add> return "http://localhost:" + this.port + path; <add> } <add> <add> <add> @Configuration <add> @ComponentScan(resourcePattern = "**/CrossOriginAnnotationIntegrationTests*") <add> @SuppressWarnings({"unused", "WeakerAccess"}) <add> static class WebConfig extends WebReactiveConfiguration { <add> <add> } <add> <add> @RestController <add> private static class MethodLevelController { <add> <add> @RequestMapping(path = "/no", method = RequestMethod.GET) <add> public String noAnnotation() { <add> return "no"; <add> } <add> <add> @RequestMapping(path = "/no", method = RequestMethod.POST) <add> public String noAnnotationPost() { <add> return "no-post"; <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/default", method = RequestMethod.GET) <add> public String defaultAnnotation() { <add> return "default"; <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/default", method = RequestMethod.GET, params = "q") <add> public void defaultAnnotationWithParams() { <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/ambiguous-header", method = RequestMethod.GET, headers = "header1=a") <add> public void ambigousHeader1a() { <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/ambiguous-header", method = RequestMethod.GET, headers = "header1=b") <add> public void ambigousHeader1b() { <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/ambiguous-produces", method = RequestMethod.GET, produces = "application/xml") <add> public String ambigousProducesXml() { <add> return "<a></a>"; <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/ambiguous-produces", method = RequestMethod.GET, produces = "application/json") <add> public String ambigousProducesJson() { <add> return "{}"; <add> } <add> <add> @CrossOrigin(origins = { "http://site1.com", "http://site2.com" }, allowedHeaders = { "header1", "header2" }, <add> exposedHeaders = { "header3", "header4" }, methods = RequestMethod.GET, maxAge = 123, allowCredentials = "false") <add> @RequestMapping(path = "/customized", method = { RequestMethod.GET, RequestMethod.POST }) <add> public String customized() { <add> return "customized"; <add> } <add> <add> @CrossOrigin("http://site1.com") <add> @RequestMapping("/origin-value-attribute") <add> public String customOriginDefinedViaValueAttribute() { <add> return "value-attribute"; <add> } <add> <add> @CrossOrigin("${myOrigin}") <add> @RequestMapping("/origin-placeholder") <add> public String customOriginDefinedViaPlaceholder() { <add> return "placeholder"; <add> } <add> } <add> <add> @RestController <add> @CrossOrigin(allowCredentials = "false") <add> private static class ClassLevelController { <add> <add> @RequestMapping(path = "/foo", method = RequestMethod.GET) <add> public String foo() { <add> return "foo"; <add> } <add> <add> @CrossOrigin <add> @RequestMapping(path = "/bar", method = RequestMethod.GET) <add> public String bar() { <add> return "bar"; <add> } <add> <add> @CrossOrigin(allowCredentials = "true") <add> @RequestMapping(path = "/baz", method = RequestMethod.GET) <add> public String baz() { <add> return "baz"; <add> } <add> <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/web/cors/reactive/CorsConfigurationSource.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.server.ServerWebExchange; <add> <add>/** <add> * Interface to be implemented by classes (usually HTTP request handlers) that <add> * provides a {@link CorsConfiguration} instance based on the provided reactive request. <add> * <add> * @author Sebastien Deleuze <add> * @since 5.0 <add> */ <add>public interface CorsConfigurationSource { <add> <add> /** <add> * Return a {@link CorsConfiguration} based on the incoming request. <add> * @return the associated {@link CorsConfiguration}, or {@code null} if none <add> */ <add> CorsConfiguration getCorsConfiguration(ServerWebExchange exchange); <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/web/cors/reactive/CorsProcessor.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import reactor.core.publisher.Mono; <add> <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.server.ServerWebExchange; <add> <add>/** <add> * A strategy that takes a reactive request and a {@link CorsConfiguration} and updates <add> * the response. <add> * <add> * <p>This component is not concerned with how a {@code CorsConfiguration} is <add> * selected but rather takes follow-up actions such as applying CORS validation <add> * checks and either rejecting the response or adding CORS headers to the <add> * response. <add> * <add> * @author Sebastien Deleuze <add> * @author Rossen Stoyanchev <add> * @since 5.0 <add> * @see <a href="http://www.w3.org/TR/cors/">CORS W3C recommandation</a> <add> */ <add>public interface CorsProcessor { <add> <add> /** <add> * Process a request given a {@code CorsConfiguration}. <add> * @param configuration the applicable CORS configuration (possibly {@code null}) <add> * @param exchange the current HTTP request / response <add> * @return a {@link Mono} emitting {@code false} if the request is rejected, {@code true} otherwise <add> */ <add> boolean processRequest(CorsConfiguration configuration, ServerWebExchange exchange); <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/web/cors/reactive/CorsUtils.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <add>import org.springframework.util.Assert; <add>import org.springframework.web.util.UriComponents; <add>import org.springframework.web.util.UriComponentsBuilder; <add> <add>; <add> <add>/** <add> * Utility class for CORS reactive request handling based on the <add> * <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>. <add> * <add> * @author Sebastien Deleuze <add> * @since 5.0 <add> */ <add>public abstract class CorsUtils { <add> <add> /** <add> * Returns {@code true} if the request is a valid CORS one. <add> */ <add> public static boolean isCorsRequest(ServerHttpRequest request) { <add> return (request.getHeaders().get(HttpHeaders.ORIGIN) != null); <add> } <add> <add> /** <add> * Returns {@code true} if the request is a valid CORS pre-flight one. <add> */ <add> public static boolean isPreFlightRequest(ServerHttpRequest request) { <add> return (isCorsRequest(request) && HttpMethod.OPTIONS == request.getMethod() && <add> request.getHeaders().get(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD) != null); <add> } <add> <add> /** <add> * Check if the request is a same-origin one, based on {@code Origin}, {@code Host}, <add> * {@code Forwarded} and {@code X-Forwarded-Host} headers. <add> * @return {@code true} if the request is a same-origin one, {@code false} in case <add> * of cross-origin request. <add> */ <add> public static boolean isSameOrigin(ServerHttpRequest request) { <add> String origin = request.getHeaders().getOrigin(); <add> if (origin == null) { <add> return true; <add> } <add> UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromHttpRequest(request); <add> UriComponents actualUrl = urlBuilder.build(); <add> String actualHost = actualUrl.getHost(); <add> int actualPort = getPort(actualUrl); <add> Assert.notNull(actualHost, "Actual request host must not be null"); <add> Assert.isTrue(actualPort != -1, "Actual request port must not be undefined"); <add> UriComponents originUrl = UriComponentsBuilder.fromOriginHeader(origin).build(); <add> return (actualHost.equals(originUrl.getHost()) && actualPort == getPort(originUrl)); <add> } <add> <add> private static int getPort(UriComponents uri) { <add> int port = uri.getPort(); <add> if (port == -1) { <add> if ("http".equals(uri.getScheme()) || "ws".equals(uri.getScheme())) { <add> port = 80; <add> } <add> else if ("https".equals(uri.getScheme()) || "wss".equals(uri.getScheme())) { <add> port = 443; <add> } <add> } <add> return port; <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/web/cors/reactive/DefaultCorsProcessor.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import java.util.ArrayList; <add>import java.util.List; <add> <add>import org.apache.commons.logging.Log; <add>import org.apache.commons.logging.LogFactory; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.HttpStatus; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <add>import org.springframework.http.server.reactive.ServerHttpResponse; <add>import org.springframework.util.CollectionUtils; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.server.ServerWebExchange; <add>import org.springframework.web.util.WebUtils; <add> <add>/** <add> * The default implementation of {@link CorsProcessor}, <add> * as defined by the <a href="http://www.w3.org/TR/cors/">CORS W3C recommendation</a>. <add> * <add> * <p>Note that when input {@link CorsConfiguration} is {@code null}, this <add> * implementation does not reject simple or actual requests outright but simply <add> * avoid adding CORS headers to the response. CORS processing is also skipped <add> * if the response already contains CORS headers, or if the request is detected <add> * as a same-origin one. <add> * <add> * @author Sebastien Deleuze <add> * @author Rossen Stoyanchev <add> * @since 5.0 <add> */ <add>public class DefaultCorsProcessor implements CorsProcessor { <add> <add> private static final Log logger = LogFactory.getLog(DefaultCorsProcessor.class); <add> <add> <add> @Override <add> @SuppressWarnings("resource") <add> public boolean processRequest(CorsConfiguration config, ServerWebExchange exchange) { <add> <add> ServerHttpRequest request = exchange.getRequest(); <add> ServerHttpResponse response = exchange.getResponse(); <add> <add> if (!CorsUtils.isCorsRequest(request)) { <add> return true; <add> } <add> <add> if (responseHasCors(response)) { <add> logger.debug("Skip CORS processing: response already contains \"Access-Control-Allow-Origin\" header"); <add> return true; <add> } <add> <add> if (CorsUtils.isSameOrigin(request)) { <add> logger.debug("Skip CORS processing: request is from same origin"); <add> return true; <add> } <add> <add> boolean preFlightRequest = CorsUtils.isPreFlightRequest(request); <add> if (config == null) { <add> if (preFlightRequest) { <add> rejectRequest(response); <add> return false; <add> } <add> else { <add> return true; <add> } <add> } <add> <add> return handleInternal(exchange, config, preFlightRequest); <add> } <add> <add> private boolean responseHasCors(ServerHttpResponse response) { <add> return (response.getHeaders().getAccessControlAllowOrigin() != null); <add> } <add> <add> /** <add> * Invoked when one of the CORS checks failed. <add> */ <add> protected void rejectRequest(ServerHttpResponse response) { <add> response.setStatusCode(HttpStatus.FORBIDDEN); <add> logger.debug("Invalid CORS request"); <add> } <add> <add> /** <add> * Handle the given request. <add> */ <add> protected boolean handleInternal(ServerWebExchange exchange, <add> CorsConfiguration config, boolean preFlightRequest) { <add> <add> ServerHttpRequest request = exchange.getRequest(); <add> ServerHttpResponse response = exchange.getResponse(); <add> <add> String requestOrigin = request.getHeaders().getOrigin(); <add> String allowOrigin = checkOrigin(config, requestOrigin); <add> <add> HttpMethod requestMethod = getMethodToUse(request, preFlightRequest); <add> List<HttpMethod> allowMethods = checkMethods(config, requestMethod); <add> <add> List<String> requestHeaders = getHeadersToUse(request, preFlightRequest); <add> List<String> allowHeaders = checkHeaders(config, requestHeaders); <add> <add> if (allowOrigin == null || allowMethods == null || (preFlightRequest && allowHeaders == null)) { <add> rejectRequest(response); <add> return false; <add> } <add> <add> HttpHeaders responseHeaders = response.getHeaders(); <add> responseHeaders.setAccessControlAllowOrigin(allowOrigin); <add> responseHeaders.add(HttpHeaders.VARY, HttpHeaders.ORIGIN); <add> <add> if (preFlightRequest) { <add> responseHeaders.setAccessControlAllowMethods(allowMethods); <add> } <add> <add> if (preFlightRequest && !allowHeaders.isEmpty()) { <add> responseHeaders.setAccessControlAllowHeaders(allowHeaders); <add> } <add> <add> if (!CollectionUtils.isEmpty(config.getExposedHeaders())) { <add> responseHeaders.setAccessControlExposeHeaders(config.getExposedHeaders()); <add> } <add> <add> if (Boolean.TRUE.equals(config.getAllowCredentials())) { <add> responseHeaders.setAccessControlAllowCredentials(true); <add> } <add> <add> if (preFlightRequest && config.getMaxAge() != null) { <add> responseHeaders.setAccessControlMaxAge(config.getMaxAge()); <add> } <add> <add> return true; <add> } <add> <add> /** <add> * Check the origin and determine the origin for the response. The default <add> * implementation simply delegates to <add> * {@link CorsConfiguration#checkOrigin(String)}. <add> */ <add> protected String checkOrigin(CorsConfiguration config, String requestOrigin) { <add> return config.checkOrigin(requestOrigin); <add> } <add> <add> /** <add> * Check the HTTP method and determine the methods for the response of a <add> * pre-flight request. The default implementation simply delegates to <add> * {@link CorsConfiguration#checkOrigin(String)}. <add> */ <add> protected List<HttpMethod> checkMethods(CorsConfiguration config, HttpMethod requestMethod) { <add> return config.checkHttpMethod(requestMethod); <add> } <add> <add> private HttpMethod getMethodToUse(ServerHttpRequest request, boolean isPreFlight) { <add> return (isPreFlight ? request.getHeaders().getAccessControlRequestMethod() : request.getMethod()); <add> } <add> <add> /** <add> * Check the headers and determine the headers for the response of a <add> * pre-flight request. The default implementation simply delegates to <add> * {@link CorsConfiguration#checkOrigin(String)}. <add> */ <add> protected List<String> checkHeaders(CorsConfiguration config, List<String> requestHeaders) { <add> return config.checkHeaders(requestHeaders); <add> } <add> <add> private List<String> getHeadersToUse(ServerHttpRequest request, boolean isPreFlight) { <add> HttpHeaders headers = request.getHeaders(); <add> return (isPreFlight ? headers.getAccessControlRequestHeaders() : new ArrayList<>(headers.keySet())); <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import java.util.Collections; <add>import java.util.LinkedHashMap; <add>import java.util.Map; <add> <add>import org.springframework.util.AntPathMatcher; <add>import org.springframework.util.Assert; <add>import org.springframework.util.PathMatcher; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.server.ServerWebExchange; <add>import org.springframework.web.util.HttpRequestPathHelper; <add> <add>/** <add> * Provide a per reactive request {@link CorsConfiguration} instance based on a <add> * collection of {@link CorsConfiguration} mapped on path patterns. <add> * <add> * <p>Exact path mapping URIs (such as {@code "/admin"}) are supported <add> * as well as Ant-style path patterns (such as {@code "/admin/**"}). <add> * <add> * @author Sebastien Deleuze <add> * @since 5.0 <add> */ <add>public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource { <add> <add> private final Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<>(); <add> <add> private PathMatcher pathMatcher = new AntPathMatcher(); <add> <add> private HttpRequestPathHelper pathHelper = new HttpRequestPathHelper(); <add> <add> <add> /** <add> * Set the PathMatcher implementation to use for matching URL paths <add> * against registered URL patterns. Default is AntPathMatcher. <add> * @see AntPathMatcher <add> */ <add> public void setPathMatcher(PathMatcher pathMatcher) { <add> Assert.notNull(pathMatcher, "PathMatcher must not be null"); <add> this.pathMatcher = pathMatcher; <add> } <add> <add> /** <add> * Set if context path and request URI should be URL-decoded. Both are returned <add> * <i>undecoded</i> by the Servlet API, in contrast to the servlet path. <add> * <p>Uses either the request encoding or the default encoding according <add> * to the Servlet spec (ISO-8859-1). <add> * @see HttpRequestPathHelper#setUrlDecode <add> */ <add> public void setUrlDecode(boolean urlDecode) { <add> this.pathHelper.setUrlDecode(urlDecode); <add> } <add> <add> /** <add> * Set the UrlPathHelper to use for resolution of lookup paths. <add> * <p>Use this to override the default UrlPathHelper with a custom subclass. <add> */ <add> public void setHttpRequestPathHelper(HttpRequestPathHelper pathHelper) { <add> Assert.notNull(pathHelper, "HttpRequestPathHelper must not be null"); <add> this.pathHelper = pathHelper; <add> } <add> <add> /** <add> * Set CORS configuration based on URL patterns. <add> */ <add> public void setCorsConfigurations(Map<String, CorsConfiguration> corsConfigurations) { <add> this.corsConfigurations.clear(); <add> if (corsConfigurations != null) { <add> this.corsConfigurations.putAll(corsConfigurations); <add> } <add> } <add> <add> /** <add> * Get the CORS configuration. <add> */ <add> public Map<String, CorsConfiguration> getCorsConfigurations() { <add> return Collections.unmodifiableMap(this.corsConfigurations); <add> } <add> <add> /** <add> * Register a {@link CorsConfiguration} for the specified path pattern. <add> */ <add> public void registerCorsConfiguration(String path, CorsConfiguration config) { <add> this.corsConfigurations.put(path, config); <add> } <add> <add> <add> @Override <add> public CorsConfiguration getCorsConfiguration(ServerWebExchange exchange) { <add> String lookupPath = this.pathHelper.getLookupPathForRequest(exchange); <add> for (Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) { <add> if (this.pathMatcher.match(entry.getKey(), lookupPath)) { <add> return entry.getValue(); <add> } <add> } <add> return null; <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java <ide> UriComponentsBuilder adaptFromForwardedHeaders(HttpHeaders headers) { <ide> } <ide> } <ide> <del> if ((this.scheme.equals("http") && "80".equals(this.port)) || <del> (this.scheme.equals("https") && "443".equals(this.port))) { <add> if ((this.scheme != null) && ((this.scheme.equals("http") && "80".equals(this.port)) || <add> (this.scheme.equals("https") && "443".equals(this.port)))) { <ide> this.port = null; <ide> } <ide> <ide><path>spring-web/src/test/java/org/springframework/web/cors/reactive/CorsUtilsTests.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import static org.junit.Assert.assertFalse; <add>import static org.junit.Assert.assertTrue; <add>import org.junit.Test; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; <add>import org.springframework.web.cors.reactive.CorsUtils; <add> <add>/** <add> * Test case for reactive {@link CorsUtils}. <add> * <add> * @author Sebastien Deleuze <add> */ <add>public class CorsUtilsTests { <add> <add> @Test <add> public void isCorsRequest() { <add> MockServerHttpRequest request = new MockServerHttpRequest(); <add> request.addHeader(HttpHeaders.ORIGIN, "http://domain.com"); <add> assertTrue(CorsUtils.isCorsRequest(request)); <add> } <add> <add> @Test <add> public void isNotCorsRequest() { <add> MockServerHttpRequest request = new MockServerHttpRequest(); <add> assertFalse(CorsUtils.isCorsRequest(request)); <add> } <add> <add> @Test <add> public void isPreFlightRequest() { <add> MockServerHttpRequest request = new MockServerHttpRequest(); <add> request.setHttpMethod(HttpMethod.OPTIONS); <add> request.addHeader(HttpHeaders.ORIGIN, "http://domain.com"); <add> request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> assertTrue(CorsUtils.isPreFlightRequest(request)); <add> } <add> <add> @Test <add> public void isNotPreFlightRequest() { <add> MockServerHttpRequest request = new MockServerHttpRequest(); <add> assertFalse(CorsUtils.isPreFlightRequest(request)); <add> <add> request = new MockServerHttpRequest(); <add> request.setHttpMethod(HttpMethod.OPTIONS); <add> request.addHeader(HttpHeaders.ORIGIN, "http://domain.com"); <add> assertFalse(CorsUtils.isPreFlightRequest(request)); <add> <add> request = new MockServerHttpRequest(); <add> request.setHttpMethod(HttpMethod.OPTIONS); <add> request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> assertFalse(CorsUtils.isPreFlightRequest(request)); <add> } <add> <add>} <ide><path>spring-web/src/test/java/org/springframework/web/cors/reactive/DefaultCorsProcessorTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import static org.junit.Assert.*; <add>import org.junit.Before; <add>import org.junit.Test; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.HttpStatus; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.cors.reactive.DefaultCorsProcessor; <add>import org.springframework.web.server.ServerWebExchange; <add>import org.springframework.web.server.adapter.DefaultServerWebExchange; <add>import org.springframework.web.server.session.MockWebSessionManager; <add> <add>/** <add> * Test reactive {@link DefaultCorsProcessor} with simple or preflight CORS request. <add> * <add> * @author Sebastien Deleuze <add> * @author Rossen Stoyanchev <add> * @author Juergen Hoeller <add> */ <add>public class DefaultCorsProcessorTests { <add> <add> private MockServerHttpRequest request; <add> <add> private MockServerHttpResponse response; <add> <add> private ServerWebExchange exchange; <add> <add> private DefaultCorsProcessor processor; <add> <add> private CorsConfiguration conf; <add> <add> <add> @Before <add> public void setup() { <add> this.request = new MockServerHttpRequest(); <add> this.request.setUri("http://localhost/test.html"); <add> this.conf = new CorsConfiguration(); <add> this.response = new MockServerHttpResponse(); <add> this.response.setStatusCode(HttpStatus.OK); <add> this.processor = new DefaultCorsProcessor(); <add> this.exchange = new DefaultServerWebExchange(this.request, this.response, new MockWebSessionManager()); <add> } <add> <add> <add> @Test <add> public void actualRequestWithOriginHeader() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void actualRequestWithOriginHeaderAndNullConfig() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> <add> this.processor.processRequest(null, this.exchange); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void actualRequestWithOriginHeaderAndAllowedOrigin() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.conf.addAllowedOrigin("*"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("*", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_MAX_AGE)); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void actualRequestCredentials() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.conf.addAllowedOrigin("http://domain1.com"); <add> this.conf.addAllowedOrigin("http://domain2.com"); <add> this.conf.addAllowedOrigin("http://domain3.com"); <add> this.conf.setAllowCredentials(true); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("http://domain2.com", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); <add> assertEquals("true", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void actualRequestCredentialsWithOriginWildcard() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.conf.addAllowedOrigin("*"); <add> this.conf.setAllowCredentials(true); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("http://domain2.com", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); <add> assertEquals("true", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void actualRequestCaseInsensitiveOriginMatch() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.conf.addAllowedOrigin("http://DOMAIN2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void actualRequestExposedHeaders() throws Exception { <add> this.request.setHttpMethod(HttpMethod.GET); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.conf.addExposedHeader("header1"); <add> this.conf.addExposedHeader("header2"); <add> this.conf.addAllowedOrigin("http://domain2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("http://domain2.com", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS)); <add> assertTrue(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS).contains("header1")); <add> assertTrue(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS).contains("header2")); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestAllOriginsAllowed() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.conf.addAllowedOrigin("*"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestWrongAllowedMethod() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "DELETE"); <add> this.conf.addAllowedOrigin("*"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestMatchedAllowedMethod() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.conf.addAllowedOrigin("*"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> assertEquals("GET,HEAD", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS)); <add> } <add> <add> @Test <add> public void preflightRequestTestWithOriginButWithoutOtherHeaders() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestWithoutRequestMethod() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestWithRequestAndMethodHeaderButNoConfig() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestValidRequestAndConfig() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1"); <add> this.conf.addAllowedOrigin("*"); <add> this.conf.addAllowedMethod("GET"); <add> this.conf.addAllowedMethod("PUT"); <add> this.conf.addAllowedHeader("header1"); <add> this.conf.addAllowedHeader("header2"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("*", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS)); <add> assertEquals("GET,PUT", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS)); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_MAX_AGE)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestCredentials() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1"); <add> this.conf.addAllowedOrigin("http://domain1.com"); <add> this.conf.addAllowedOrigin("http://domain2.com"); <add> this.conf.addAllowedOrigin("http://domain3.com"); <add> this.conf.addAllowedHeader("Header1"); <add> this.conf.setAllowCredentials(true); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("http://domain2.com", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); <add> assertEquals("true", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestCredentialsWithOriginWildcard() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1"); <add> this.conf.addAllowedOrigin("http://domain1.com"); <add> this.conf.addAllowedOrigin("*"); <add> this.conf.addAllowedOrigin("http://domain3.com"); <add> this.conf.addAllowedHeader("Header1"); <add> this.conf.setAllowCredentials(true); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals("http://domain2.com", this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestAllowedHeaders() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1, Header2"); <add> this.conf.addAllowedHeader("Header1"); <add> this.conf.addAllowedHeader("Header2"); <add> this.conf.addAllowedHeader("Header3"); <add> this.conf.addAllowedOrigin("http://domain2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS)); <add> assertTrue(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).contains("Header1")); <add> assertTrue(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).contains("Header2")); <add> assertFalse(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).contains("Header3")); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestAllowsAllHeaders() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Header1, Header2"); <add> this.conf.addAllowedHeader("*"); <add> this.conf.addAllowedOrigin("http://domain2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS)); <add> assertTrue(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).contains("Header1")); <add> assertTrue(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).contains("Header2")); <add> assertFalse(this.response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).contains("*")); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestWithEmptyHeaders() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, ""); <add> this.conf.addAllowedHeader("*"); <add> this.conf.addAllowedOrigin("http://domain2.com"); <add> <add> this.processor.processRequest(this.conf, this.exchange); <add> assertTrue(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS)); <add> assertEquals(HttpStatus.OK, this.response.getStatusCode()); <add> } <add> <add> @Test <add> public void preflightRequestWithNullConfig() throws Exception { <add> this.request.setHttpMethod(HttpMethod.OPTIONS); <add> this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com"); <add> this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); <add> this.conf.addAllowedOrigin("*"); <add> <add> this.processor.processRequest(null, this.exchange); <add> assertFalse(this.response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); <add> assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode()); <add> } <add> <add>} <ide><path>spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.cors.reactive; <add> <add>import static org.junit.Assert.assertEquals; <add>import static org.junit.Assert.assertNull; <add>import org.junit.Test; <add> <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; <add>import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; <add>import org.springframework.web.cors.CorsConfiguration; <add>import org.springframework.web.server.ServerWebExchange; <add>import org.springframework.web.server.adapter.DefaultServerWebExchange; <add>import org.springframework.web.server.session.MockWebSessionManager; <add> <add>/** <add> * Unit tests for reactive {@link UrlBasedCorsConfigurationSource}. <add> * @author Sebastien Deleuze <add> */ <add>public class UrlBasedCorsConfigurationSourceTests { <add> <add> private final UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource(); <add> <add> @Test <add> public void empty() { <add> ServerHttpRequest request = new MockServerHttpRequest(HttpMethod.GET, "/bar/test.html"); <add> ServerWebExchange exchange = new DefaultServerWebExchange(request, <add> new MockServerHttpResponse(), new MockWebSessionManager()); <add> assertNull(this.configSource.getCorsConfiguration(exchange)); <add> } <add> <add> @Test <add> public void registerAndMatch() { <add> CorsConfiguration config = new CorsConfiguration(); <add> this.configSource.registerCorsConfiguration("/bar/**", config); <add> assertNull(this.configSource.getCorsConfiguration( <add> new DefaultServerWebExchange( <add> new MockServerHttpRequest(HttpMethod.GET, "/foo/test.html"), <add> new MockServerHttpResponse(), <add> new MockWebSessionManager()))); <add> assertEquals(config, this.configSource.getCorsConfiguration(new DefaultServerWebExchange( <add> new MockServerHttpRequest(HttpMethod.GET, "/bar/test.html"), <add> new MockServerHttpResponse(), <add> new MockWebSessionManager()))); <add> } <add> <add> @Test(expected = UnsupportedOperationException.class) <add> public void unmodifiableConfigurationsMap() { <add> this.configSource.getCorsConfigurations().put("/**", new CorsConfiguration()); <add> } <add> <add>}
25
Java
Java
remove duplicate code in fabricuimanager
ec27141b93cf94c14762399c45ec0d25366afe9a
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> public void onCatalystInstanceDestroy() { <ide> mReactApplicationContext.removeLifecycleEventListener(this); <ide> onHostPause(); <ide> <del> // This is not technically thread-safe, since it's read on the UI thread and written <del> // here on the JS thread. We've marked it as volatile so that this writes to UI-thread <del> // memory immediately. <del> mDispatchUIFrameCallback.stop(); <del> <ide> mBinding.unregister(); <ide> mBinding = null; <ide>
1
PHP
PHP
remove compatibility test case and stub class
0fb3414cb24b5ceed7f5931353adb940f52062a1
<ide><path>src/Http/Client.php <ide> public function __construct($config = []) <ide> /** <ide> * Get the cookies stored in the Client. <ide> * <del> * @return \Cake\Http\Client\CookieCollection <add> * @return \Cake\Http\CookieCollection <ide> */ <ide> public function cookies() <ide> { <ide><path>tests/TestCase/Http/ClientTest.php <ide> public function testGetWithAuthenticationAndProxy() <ide> $this->assertSame($result, $response); <ide> } <ide> <del> /** <del> * Test authentication adapter that mutates request. <del> * <del> * @group deprecated <del> * @return void <del> */ <del> public function testAuthenticationWithMutation() <del> { <del> $this->deprecated(function () { <del> static::setAppNamespace(); <del> $response = new Response(); <del> $mock = $this->getMockBuilder('Cake\Http\Client\Adapter\Stream') <del> ->setMethods(['send']) <del> ->getMock(); <del> $headers = [ <del> 'Authorization' => 'Bearer abc123', <del> 'Proxy-Authorization' => 'Bearer abc123', <del> ]; <del> $mock->expects($this->once()) <del> ->method('send') <del> ->with($this->callback(function ($request) use ($headers) { <del> $this->assertEquals(Request::METHOD_GET, $request->getMethod()); <del> $this->assertEquals('http://cakephp.org/', '' . $request->getUri()); <del> $this->assertEquals($headers['Authorization'], $request->getHeaderLine('Authorization')); <del> $this->assertEquals($headers['Proxy-Authorization'], $request->getHeaderLine('Proxy-Authorization')); <del> <del> return true; <del> })) <del> ->will($this->returnValue([$response])); <del> <del> $http = new Client([ <del> 'host' => 'cakephp.org', <del> 'adapter' => $mock <del> ]); <del> $result = $http->get('/', [], [ <del> 'auth' => ['type' => 'TestApp\Http\CompatAuth'], <del> 'proxy' => ['type' => 'TestApp\Http\CompatAuth'], <del> ]); <del> $this->assertSame($result, $response); <del> }); <del> } <del> <ide> /** <ide> * Return a list of HTTP methods. <ide> * <ide><path>tests/test_app/TestApp/Http/CompatAuth.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.3.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace TestApp\Http; <del> <del>use Cake\Http\Client\Request; <del> <del>/** <del> * Testing stub to ensure that auth providers <del> * that mutate requests in place continue to work. <del> * <del> * @deprecated 3.3.0 Remove this compatibility behavior in 4.0.0 <del> */ <del>class CompatAuth <del>{ <del> <del> /** <del> * Add Authorization header to the request via in-place mutation methods. <del> * <del> * @param \Cake\Http\Client\Request $request Request instance. <del> * @param array $credentials Credentials. <del> * @return \Cake\Http\Client\Request The updated request. <del> */ <del> public function authentication(Request $request, array $credentials) <del> { <del> $request = $request->withHeader('Authorization', 'Bearer abc123'); <del> <del> return $request; <del> } <del> <del> /** <del> * Proxy Authentication added via in-place mutation methods. <del> * <del> * @param \Cake\Http\Client\Request $request Request instance. <del> * @param array $credentials Credentials. <del> * @return \Cake\Http\Client\Request The updated request. <del> */ <del> public function proxyAuthentication(Request $request, array $credentials) <del> { <del> $request = $request->withHeader('Proxy-Authorization', 'Bearer abc123'); <del> <del> return $request; <del> } <del>}
3
Javascript
Javascript
switch rotation axes
1f86be32ff4f1634f187637ae273a7313b99014c
<ide><path>examples/js/Car.js <ide> * @author Lewy Blue https://github.com/looeee <ide> * <ide> * The model is expected to follow real world car proportions. You can try unusual car types <del> * but your results may be unexpected. Scaled models are also not supported <add> * but your results may be unexpected. Scaled models are also not supported. <ide> * <del> * Defaults below are for a Ferrari F50, taken from https://en.wikipedia.org/wiki/Ferrari_F50 <add> * Defaults are rough estimates for a real world scale car model <ide> * <ide> */ <ide> <ide> THREE.Car = ( function ( ) { <ide> this.enabled = true; <ide> <ide> this.elemNames = { <del> flWheel: 'wheelFrontLeft', <del> frWheel: 'wheelFrontRight', <del> rlWheel: 'wheelBackLeft', <del> rrWheel: 'wheelBackRight', <del> steeringWheel: null, // disabled by default <add> flWheel: 'wheel_fl', <add> frWheel: 'wheel_fr', <add> rlWheel: 'wheel_rl', <add> rrWheel: 'wheel_rr', <add> steeringWheel: 'steering_wheel', // set to null to disable <ide> }; <ide> <ide> // km/hr <ide> this.maxSpeed = maxSpeed || 180; <ide> maxSpeedReverse = - this.maxSpeed * 0.25; <ide> <ide> // m/s <del> this.acceleration = acceleration || 12; <add> this.acceleration = acceleration || 10; <ide> accelerationReverse = this.acceleration * 0.5; <ide> <ide> // metres <del> this.turningRadius = turningRadius || 24; <add> this.turningRadius = turningRadius || 6; <ide> <ide> // m/s <ide> deceleration = this.acceleration * 2; <ide> THREE.Car = ( function ( ) { <ide> this.brakePower = brakePower || 10; <ide> <ide> // exposed so that a user can use this for various effect, e.g blur <del> // km / hr <ide> this.speed = 0; <ide> <ide> // keys used to control car - by default the arrow keys and space to brake <ide> controlKeys = keys || controlKeys; <ide> <del> // local axes of rotation <add> // local axes of rotation - these are likely to vary between models <ide> this.wheelRotationAxis = 'x'; <ide> this.wheelTurnAxis = 'z'; <del> this.steeringWheelTurnAxis = 'z'; <add> this.steeringWheelTurnAxis = 'y'; <ide> <ide> document.addEventListener( 'keydown', this.onKeyDown, false ); <ide> document.addEventListener( 'keyup', this.onKeyUp, false );
1
Javascript
Javascript
improve expectwarning error message
0465373d77436d8df5ec4dbe5586747f6341c300
<ide><path>test/common/index.js <ide> function _expectWarning(name, expected, code) { <ide> expected.forEach(([_, code]) => assert(code, expected)); <ide> } <ide> return mustCall((warning) => { <del> const [ message, code ] = expected.shift(); <add> const expectedProperties = expected.shift(); <add> if (!expectedProperties) { <add> assert.fail(`Unexpected extra warning received: ${warning}`); <add> } <add> const [ message, code ] = expectedProperties; <ide> assert.strictEqual(warning.name, name); <ide> if (typeof message === 'string') { <ide> assert.strictEqual(warning.message, message); <ide><path>test/parallel/test-common-expect-warning.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const assert = require('assert'); <add>const { spawn } = require('child_process'); <add> <add>if (process.argv[2] !== 'child') { <add> // Expected error not emitted. <add> { <add> const child = spawn( <add> process.execPath, [__filename, 'child', 0], { encoding: 'utf8' } <add> ); <add> child.on('exit', common.mustCall((status) => { <add> assert.notStrictEqual(status, 0); <add> })); <add> } <add> <add> // Expected error emitted. <add> { <add> const child = spawn( <add> process.execPath, [__filename, 'child', 1], { encoding: 'utf8' } <add> ); <add> child.on('exit', common.mustCall((status) => { <add> assert.strictEqual(status, 0); <add> })); <add> } <add> <add> // Expected error emitted too many times. <add> { <add> const child = spawn( <add> process.execPath, [__filename, 'child', 2], { encoding: 'utf8' } <add> ); <add> child.stderr.setEncoding('utf8'); <add> <add> let stderr = ''; <add> child.stderr.on('data', (data) => { <add> stderr += data; <add> }); <add> child.on('exit', common.mustCall((status) => { <add> assert.notStrictEqual(status, 0); <add> assert.match(stderr, /Unexpected extra warning received/); <add> })); <add> } <add>} else { <add> const iterations = +process.argv[3]; <add> common.expectWarning('fhqwhgads', 'fhqwhgads', 'fhqwhgads'); <add> for (let i = 0; i < iterations; i++) { <add> process.emitWarning('fhqwhgads', 'fhqwhgads', 'fhqwhgads'); <add> } <add>}
2
Text
Text
add missing link for 10.3.0 changelog
8976c79b6f75c9f2bb8d33b394b0d44395d97d0e
<ide><path>doc/changelogs/CHANGELOG_V10.md <ide> </tr> <ide> <tr> <ide> <td> <add><a href="#10.3.0">10.3.0</a><br/> <ide> <a href="#10.2.1">10.2.1</a><br/> <ide> <a href="#10.2.0">10.2.0</a><br/> <ide> <a href="#10.1.0">10.1.0</a><br/>
1
Python
Python
add compile flag to disable voltbl on msvc 142
422701d0f8b03d5552a7ed6b6eea0ffdbfd3dadf
<ide><path>numpy/core/setup.py <ide> def get_mathlib_info(*args): <ide> join('src', 'npymath', 'halffloat.c') <ide> ] <ide> <del> def gl_if_msvc(build_cmd): <del> """ Add flag if we are using MSVC compiler <add> def opts_if_msvc(build_cmd): <add> """ Add flags if we are using MSVC compiler <ide> <del> We can't see this in our scope, because we have not initialized the <del> distutils build command, so use this deferred calculation to run when <del> we are building the library. <add> We can't see `build_cmd` in our scope, because we have not initialized <add> the distutils build command, so use this deferred calculation to run <add> when we are building the library. <ide> """ <del> if build_cmd.compiler.compiler_type == 'msvc': <del> # explicitly disable whole-program optimization <del> return ['/GL-'] <del> return [] <add> if build_cmd.compiler.compiler_type != 'msvc': <add> return [] <add> # Explicitly disable whole-program optimization. <add> flags = ['/GL-'] <add> # Disable voltbl section for vc142 to allow link using mingw-w64; see: <add> # https://github.com/matthew-brett/dll_investigation/issues/1#issuecomment-1100468171 <add> if build_cmd.compiler_opt.cc_test_flags(['-d2VolatileMetadata-']): <add> flags.append('-d2VolatileMetadata-') <add> return flags <ide> <ide> config.add_installed_library('npymath', <ide> sources=npymath_sources + [get_mathlib_info], <ide> install_dir='lib', <ide> build_info={ <ide> 'include_dirs' : [], # empty list required for creating npy_math_internal.h <del> 'extra_compiler_args': [gl_if_msvc], <add> 'extra_compiler_args': [opts_if_msvc], <ide> }) <ide> config.add_npy_pkg_config("npymath.ini.in", "lib/npy-pkg-config", <ide> subst_dict)
1
Javascript
Javascript
remove incorrect attributes
361990401342186150f43004eb35f2a83dfc3789
<ide><path>packages/ember-views/lib/system/build-component-template.js <ide> export default function buildComponentTemplate({ component, layout, isAngleBrack <ide> blockToRender = createLayoutBlock(layout.raw, yieldTo, content.self, component, attrs, attributes); <ide> meta = layout.raw.meta; <ide> } else if (content.templates && content.templates.default) { <del> let attributes = (component && component._isAngleBracket) ? normalizeComponentAttributes(component, true, attrs) : undefined; <del> blockToRender = createContentBlock(content.templates.default, content.scope, content.self, component, attributes); <add> blockToRender = createContentBlock(content.templates.default, content.scope, content.self, component); <ide> meta = content.templates.default.meta; <ide> } <ide>
1
Javascript
Javascript
add minor clarification
f779230f70d12cbc075971f14acf382a5d3fd1d0
<ide><path>src/ngResource/resource.js <ide> function shallowClearAndCopy(src, dst) { <ide> * set `transformResponse` to an empty array: `transformResponse: []` <ide> * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the <ide> * GET request, otherwise if a cache instance built with <del> * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for <add> * {@link ng.$cacheFactory $cacheFactory} is supplied, this cache will be used for <ide> * caching. <ide> * - **`timeout`** – `{number}` – timeout in milliseconds.<br /> <ide> * **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
1
Javascript
Javascript
remove rebase error
ee865c24317d2f48b4ae8fa0d01a9c476801d5dd
<ide><path>packages/ember-htmlbars/lib/main.js <ide> import makeBoundHelper from "ember-htmlbars/system/make_bound_helper"; <ide> import { <ide> registerHelper <ide> } from "ember-htmlbars/helpers"; <del>import viewHelper from "ember-htmlbars/helpers/view"; <ide> import { <ide> ifHelper, <ide> unlessHelper <ide> import "ember-htmlbars/system/bootstrap"; <ide> // Ember.Handlebars global if htmlbars is enabled <ide> import "ember-htmlbars/compat"; <ide> <del>registerHelper('@view', viewHelper); <ide> registerHelper('if', ifHelper); <ide> registerHelper('unless', unlessHelper); <ide> registerHelper('with', withHelper);
1
PHP
PHP
initialize conditions property and fix docblock
ed1ede2a14e0db78d8172a596ac0acab38de03a1
<ide><path>src/Illuminate/View/Compilers/BladeCompiler.php <ide> class BladeCompiler extends Compiler implements CompilerInterface <ide> */ <ide> protected $customDirectives = []; <ide> <add> /** <add> * All custom directives conditions, used <add> * by the "if" and "check" methods <add> * <add> * @var array <add> */ <add> protected $conditions = []; <add> <ide> /** <ide> * The file currently being compiled. <ide> * <ide> public function getExtensions() <ide> * Register an "if" statement directive. <ide> * <ide> * @param string $name <del> * @param \Closrue $callback <add> * @param \Closure $callback <ide> * @return void <ide> */ <ide> public function if($name, Closure $callback)
1
PHP
PHP
consider protocoless urls as valid. closes.
5d63d5ad524688fdbf55b926e256c967e50d660e
<ide><path>laravel/url.php <ide> public static function transpose($uri, $parameters) <ide> */ <ide> public static function valid($url) <ide> { <add> if (starts_with($url, '//')) return true; <add> <ide> return filter_var($url, FILTER_VALIDATE_URL) !== false; <ide> } <ide>
1
Python
Python
fix accelerate.framework flags
3bb97a76e2513370b6612e259ed510b74baf057e
<ide><path>scipy/distutils/system_info.py <ide> def calc_info(self): <ide> args = [] <ide> link_args = [] <ide> if os.path.exists('/System/Library/Frameworks/Accelerate.framework/'): <del> args.extend(['-faltivec','-framework','Accelerate']) <add> args.extend(['-faltivec']) <ide> link_args.extend(['-Wl,-framework','-Wl,Accelerate']) <ide> elif os.path.exists('/System/Library/Frameworks/vecLib.framework/'): <del> args.extend(['-faltivec','-framework','vecLib']) <add> args.extend(['-faltivec']) <ide> link_args.extend(['-Wl,-framework','-Wl,vecLib']) <ide> if args: <ide> self.set_info(extra_compile_args=args, <ide> def calc_info(self): <ide> args = [] <ide> link_args = [] <ide> if os.path.exists('/System/Library/Frameworks/Accelerate.framework/'): <del> args.extend(['-faltivec','-framework','Accelerate']) <add> args.extend(['-faltivec', <add> '-I/System/Library/Frameworks/vecLib.framework/Headers', <add> ]) <ide> link_args.extend(['-Wl,-framework','-Wl,Accelerate']) <ide> elif os.path.exists('/System/Library/Frameworks/vecLib.framework/'): <del> args.extend(['-faltivec','-framework','vecLib']) <add> args.extend(['-faltivec', <add> '-I/System/Library/Frameworks/vecLib.framework/Headers', <add> ]) <ide> link_args.extend(['-Wl,-framework','-Wl,vecLib']) <ide> if args: <ide> self.set_info(extra_compile_args=args,
1
Text
Text
remove usage of you in n-api doc
629a4476f0e0a919c27594ca1f3121a7ee5e4fa9
<ide><path>doc/api/n-api.md <ide> required in order to enable correct proper of the reference. <ide> Afterward, additional manipulation of the wrapper's prototype chain may cause <ide> `napi_unwrap()` to fail. <ide> <del>*Note*: Calling `napi_wrap()` a second time on an object that already has a <del>native instance associated with it by virtue of a previous call to <del>`napi_wrap()` will cause an error to be returned. If you wish to associate <del>another native instance with the given object, call `napi_remove_wrap()` on it <del>first. <add>Calling napi_wrap() a second time on an object will return an error. To associate <add>another native instance with the object, use napi_remove_wrap() first. <ide> <ide> ### napi_unwrap <ide> <!-- YAML
1
PHP
PHP
pluginassetsshell tests no longer fail on hhvm
b21ae49f5ea88a5d283c547b0da8678232e8a2a7
<ide><path>tests/TestCase/Shell/PluginAssetsShellTest.php <ide> public function setUp() <ide> 'Skip PluginAssetsShell tests on windows to prevent side effects for UrlHelper tests on AppVeyor.' <ide> ); <ide> <del> $this->skipIf( <del> defined('HHVM_VERSION'), <del> 'Also broken in HHVM, maybe the tests are wrong?' <del> ); <del> <ide> $this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); <ide> <ide> $this->shell = $this->getMock(
1
Ruby
Ruby
improve action view `translate` helper
d81926fdacbeb384d211e22cff66195c1a753eb5
<ide><path>actionview/lib/action_view/helpers/translation_helper.rb <ide> # frozen_string_literal: true <ide> <ide> require "action_view/helpers/tag_helper" <del>require "active_support/core_ext/string/access" <del>require "i18n/exceptions" <add>require "active_support/core_ext/symbol/starts_ends_with" <ide> <ide> module ActionView <ide> # = Action View Translation Helpers <ide> module TranslationHelper <ide> # resolved against. <ide> # <ide> def translate(key, **options) <del> unless options[:default].nil? <del> remaining_defaults = Array.wrap(options.delete(:default)).compact <del> options[:default] = remaining_defaults unless remaining_defaults.first.kind_of?(Symbol) <del> end <add> return key.map { |k| translate(k, **options) } if key.is_a?(Array) <ide> <del> # If the user has explicitly decided to NOT raise errors, pass that option to I18n. <del> # Otherwise, tell I18n to raise an exception, which we rescue further in this method. <del> # Note: `raise_error` refers to us re-raising the error in this method. I18n is forced to raise by default. <del> if options[:raise] == false <del> raise_error = false <del> i18n_raise = false <del> else <del> raise_error = options[:raise] || ActionView::Base.raise_on_missing_translations <del> i18n_raise = true <add> alternatives = if options.key?(:default) <add> options[:default].is_a?(Array) ? options.delete(:default).compact : [options.delete(:default)] <ide> end <ide> <del> fully_resolved_key = scope_key_by_partial(key) <add> options[:raise] = true if options[:raise].nil? && ActionView::Base.raise_on_missing_translations <add> default = MISSING_TRANSLATION <ide> <del> if html_safe_translation_key?(key) <del> html_safe_options = html_escape_translation_options(options) <del> html_safe_options[:default] = MISSING_TRANSLATION unless html_safe_options[:default].blank? <add> translation = while key <add> if alternatives.blank? && !options[:raise].nil? <add> default = NO_DEFAULT # let I18n handle missing translation <add> end <ide> <del> translation = I18n.translate(fully_resolved_key, **html_safe_options.merge(raise: i18n_raise)) <add> key = scope_key_by_partial(key) <add> first_key ||= key <ide> <del> if translation.equal?(MISSING_TRANSLATION) <del> translated_text = options[:default].first <add> if html_safe_translation_key?(key) <add> html_safe_options ||= html_escape_translation_options(options) <add> translated = I18n.translate(key, **html_safe_options, default: default) <add> break html_safe_translation(translated) unless translated.equal?(MISSING_TRANSLATION) <ide> else <del> translated_text = html_safe_translation(translation) <add> translated = I18n.translate(key, **options, default: default) <add> break translated unless translated.equal?(MISSING_TRANSLATION) <ide> end <del> else <del> translated_text = I18n.translate(fully_resolved_key, **options.merge(raise: i18n_raise)) <del> end <ide> <del> if block_given? <del> yield(translated_text, fully_resolved_key) <del> else <del> translated_text <del> end <del> rescue I18n::MissingTranslationData => e <del> if remaining_defaults.present? <del> translate remaining_defaults.shift, **options.merge(default: remaining_defaults) <del> else <del> raise e if raise_error <add> break alternatives.first if alternatives.present? && !alternatives.first.is_a?(Symbol) <ide> <del> translated_fallback = missing_translation(e, options) <add> key = alternatives&.shift <add> end <ide> <del> if block_given? <del> yield(translated_fallback, scope_key_by_partial(key)) <del> else <del> translated_fallback <del> end <add> if key.nil? <add> translation = missing_translation(first_key, options) <add> key = first_key <ide> end <add> <add> block_given? ? yield(translation, key) : translation <ide> end <ide> alias :t :translate <ide> <ide> def localize(object, **options) <ide> MISSING_TRANSLATION = Object.new <ide> private_constant :MISSING_TRANSLATION <ide> <add> NO_DEFAULT = [].freeze <add> private_constant :NO_DEFAULT <add> <add> def self.i18n_option?(name) <add> (@i18n_option_names ||= I18n::RESERVED_KEYS.to_set).include?(name) <add> end <add> <ide> def scope_key_by_partial(key) <del> stringified_key = key.to_s <del> if stringified_key.start_with?(".") <add> if key.start_with?(".") <ide> if @current_template&.virtual_path <ide> @_scope_key_by_partial_cache ||= {} <ide> @_scope_key_by_partial_cache[@current_template.virtual_path] ||= @current_template.virtual_path.gsub(%r{/_?}, ".") <del> "#{@_scope_key_by_partial_cache[@current_template.virtual_path]}#{stringified_key}" <add> "#{@_scope_key_by_partial_cache[@current_template.virtual_path]}#{key}" <ide> else <ide> raise "Cannot use t(#{key.inspect}) shortcut because path is not available" <ide> end <ide> def scope_key_by_partial(key) <ide> end <ide> <ide> def html_escape_translation_options(options) <add> return options if options.empty? <ide> html_safe_options = options.dup <ide> <del> options.except(*I18n::RESERVED_KEYS).each do |name, value| <del> unless name == :count && value.is_a?(Numeric) <add> options.each do |name, value| <add> unless TranslationHelper.i18n_option?(name) || (name == :count && value.is_a?(Numeric)) <ide> html_safe_options[name] = ERB::Util.html_escape(value.to_s) <ide> end <ide> end <ide> def html_escape_translation_options(options) <ide> end <ide> <ide> def html_safe_translation_key?(key) <del> /(?:_|\b)html\z/.match?(key.to_s) <add> /(?:_|\b)html\z/.match?(key) <ide> end <ide> <ide> def html_safe_translation(translation) <ide> def html_safe_translation(translation) <ide> end <ide> end <ide> <del> def missing_translation(error, options) <del> keys = I18n.normalize_keys(error.locale, error.key, error.options[:scope]) <add> def missing_translation(key, options) <add> keys = I18n.normalize_keys(options[:locale] || I18n.locale, key, options[:scope]) <ide> <ide> title = +"translation missing: #{keys.join(".")}" <ide> <del> interpolations = options.except(:default, :scope) <del> if interpolations.any? <del> title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(", ") <add> options.each do |name, value| <add> unless name == :scope <add> title << ", " << name.to_s << ": " << ERB::Util.html_escape(value) <add> end <ide> end <ide> <ide> if ActionView::Base.debug_missing_translation <ide><path>actionview/test/template/translation_helper_test.rb <ide> class TranslationHelperTest < ActiveSupport::TestCase <ide> end <ide> <ide> def test_delegates_setting_to_i18n <del> assert_called_with(I18n, :translate, [:foo, locale: "en", raise: true], returns: "") do <add> matcher_called = false <add> matcher = ->(key, options) do <add> matcher_called = true <add> assert_equal :foo, key <add> assert_equal "en", options[:locale] <add> end <add> <add> I18n.stub(:translate, matcher) do <ide> translate :foo, locale: "en" <ide> end <add> <add> assert matcher_called <ide> end <ide> <ide> def test_delegates_localize_to_i18n <ide> def test_translate_marks_array_of_translations_with_a_html_safe_suffix_as_safe_h <ide> end <ide> end <ide> <add> def test_translate_with_default_and_raise_false <add> translation = translate(:"translations.missing", default: :"translations.foo", raise: false) <add> assert_equal "Foo", translation <add> end <add> <ide> def test_translate_with_default_named_html <ide> translation = translate(:'translations.missing', default: :'translations.hello_html') <ide> assert_equal "<a>Hello World</a>", translation <ide> assert_equal true, translation.html_safe? <ide> end <ide> <add> def test_translate_with_default_named_html_and_raise_false <add> translation = translate(:"translations.missing", default: :"translations.hello_html", raise: false) <add> assert_equal "<a>Hello World</a>", translation <add> assert_predicate translation, :html_safe? <add> end <add> <ide> def test_translate_with_missing_default <del> translation = translate(:'translations.missing', default: :'translations.missing_html') <del> expected = '<span class="translation_missing" title="translation missing: en.translations.missing_html">Missing Html</span>' <add> translation = translate(:"translations.missing", default: :also_missing) <add> expected = '<span class="translation_missing" title="translation missing: en.translations.missing">Missing</span>' <ide> assert_equal expected, translation <ide> assert_equal true, translation.html_safe? <ide> end <ide> def test_translate_bulk_lookup <ide> assert_equal ["Foo", "Foo"], translations <ide> end <ide> <add> def test_translate_bulk_lookup_with_default <add> translations = translate([:"translations.missing", :"translations.missing"], default: :"translations.foo") <add> assert_equal ["Foo", "Foo"], translations <add> end <add> <add> def test_translate_bulk_lookup_html <add> translations = translate([:"translations.html", :"translations.hello_html"]) <add> assert_equal ["<a>Hello World</a>", "<a>Hello World</a>"], translations <add> translations.each do |translation| <add> assert_predicate translation, :html_safe? <add> end <add> end <add> <add> def test_translate_bulk_lookup_html_with_default <add> translations = translate([:"translations.missing", :"translations.missing"], default: :"translations.html") <add> assert_equal ["<a>Hello World</a>", "<a>Hello World</a>"], translations <add> translations.each do |translation| <add> assert_predicate translation, :html_safe? <add> end <add> end <add> <ide> def test_translate_does_not_change_options <ide> options = {} <ide> if RUBY_VERSION >= "2.7"
2
PHP
PHP
add shared locks to filesystem and cache/filestore
0b3bc1b6202c4baefd7c29f6a27948192a7cdbd3
<ide><path>src/Illuminate/Cache/FileStore.php <ide> protected function getPayload($key) <ide> // just return null. Otherwise, we'll get the contents of the file and get <ide> // the expiration UNIX timestamps from the start of the file's contents. <ide> try { <del> $expire = substr($contents = $this->files->get($path), 0, 10); <add> $expire = substr($contents = $this->files->get($path, true), 0, 10); <ide> } catch (Exception $e) { <ide> return ['data' => null, 'time' => null]; <ide> } <ide> public function put($key, $value, $minutes) <ide> <ide> $this->createCacheDirectory($path = $this->path($key)); <ide> <del> $this->files->put($path, $value); <add> $this->files->put($path, $value, true); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Filesystem/Filesystem.php <ide> public function exists($path) <ide> * Get the contents of a file. <ide> * <ide> * @param string $path <add> * @param bool $lock <ide> * @return string <ide> * <ide> * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException <ide> */ <del> public function get($path) <add> public function get($path, $lock = false) <ide> { <ide> if ($this->isFile($path)) { <add> if ($lock) { <add> return $this->sharedGet($path, $lock); <add> } <ide> return file_get_contents($path); <ide> } <ide> <ide> throw new FileNotFoundException("File does not exist at path {$path}"); <ide> } <ide> <add> /** <add> * Get contents of a file with shared access <add> * <add> * @param string $path <add> * @return string <add> */ <add> public function sharedGet($path) <add> { <add> $contents = ''; <add> $handle = fopen($path, 'r'); <add> if ($handle) { <add> if (flock($handle, LOCK_SH)) { <add> while (!feof($handle)) { <add> $contents .= fread($handle, 1048576); <add> } <add> } <add> fclose($handle); <add> } <add> return $contents; <add> } <add> <ide> /** <ide> * Get the returned value of a file. <ide> * <ide><path>tests/Filesystem/FilesystemTest.php <ide> public function testMakeDirectory() <ide> $this->assertFileExists(__DIR__.'/foo'); <ide> @rmdir(__DIR__.'/foo'); <ide> } <add> <add> public function testSharedGet() <add> { <add> $content = ''; <add> for ($i = 0; $i < 1000000; ++$i) { <add> $content .= $i; <add> } <add> $result = 1; <add> <add> for ($i = 1; $i <= 20; ++$i) { <add> $pid = pcntl_fork(); <add> <add> if (!$pid) { <add> $files = new Filesystem; <add> $files->put(__DIR__.'/file.txt', $content, true); <add> $read = $files->get(__DIR__.'/file.txt', true); <add> <add> exit(($read === $content) ? 1 : 0); <add> } <add> } <add> <add> while (pcntl_waitpid(0, $status) != -1) { <add> $status = pcntl_wexitstatus($status); <add> $result *= $status; <add> } <add> <add> $this->assertTrue($result === 1); <add> @unlink(__DIR__.'/file.txt'); <add> } <ide> }
3
Python
Python
use new kombu.utils modules
de180b75283bfcbd382e9dab220afe0f4d770e96
<ide><path>celery/app/amqp.py <ide> from kombu import pools <ide> from kombu import Connection, Consumer, Exchange, Producer, Queue <ide> from kombu.common import Broadcast <del>from kombu.utils import cached_property <ide> from kombu.utils.functional import maybe_list <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import signals <ide> from celery.five import items, string_t <ide><path>celery/app/base.py <ide> from kombu import pools <ide> from kombu.clocks import LamportClock <ide> from kombu.common import oid_from <del>from kombu.utils import cached_property, register_after_fork, uuid <add>from kombu.utils.compat import register_after_fork <add>from kombu.utils.objects import cached_property <add>from kombu.utils.uuid import uuid <ide> from vine import starpromise <ide> from vine.utils import wraps <ide> <ide><path>celery/app/control.py <ide> from billiard.common import TERM_SIGNAME <ide> <ide> from kombu.pidbox import Mailbox <del>from kombu.utils import cached_property <ide> from kombu.utils.functional import lazy <add>from kombu.utils.objects import cached_property <ide> <ide> from celery.exceptions import DuplicateNodenameWarning <ide> from celery.utils.text import pluralize <ide><path>celery/app/task.py <ide> import sys <ide> <ide> from billiard.einfo import ExceptionInfo <del>from kombu.utils import uuid <add>from kombu.utils.uuid import uuid <ide> <ide> from celery import current_app, group <ide> from celery import states <ide><path>celery/backends/async.py <ide> from weakref import WeakKeyDictionary <ide> <ide> from kombu.syn import detect_environment <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import states <ide> from celery.exceptions import TimeoutError <ide><path>celery/backends/cache.py <ide> <ide> import sys <ide> <del>from kombu.utils import cached_property <ide> from kombu.utils.encoding import bytes_to_str, ensure_bytes <add>from kombu.utils.objects import cached_property <ide> <ide> from celery.exceptions import ImproperlyConfigured <ide> from celery.utils.functional import LRUCache <ide><path>celery/backends/database/session.py <ide> from sqlalchemy.orm import sessionmaker <ide> from sqlalchemy.pool import NullPool <ide> <del>from kombu.utils import register_after_fork <add>from kombu.utils.compat import register_after_fork <ide> <ide> ResultModelBase = declarative_base() <ide> <ide><path>celery/backends/mongodb.py <ide> <ide> from datetime import datetime, timedelta <ide> <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> from kombu.utils.url import maybe_sanitize_url <ide> from kombu.exceptions import EncodeError <add> <ide> from celery import states <ide> from celery.exceptions import ImproperlyConfigured <ide> from celery.five import string_t, items <ide><path>celery/backends/redis.py <ide> <ide> from functools import partial <ide> <del>from kombu.utils import cached_property, retry_over_time <add>from kombu.utils.functional import retry_over_time <add>from kombu.utils.objects import cached_property <ide> from kombu.utils.url import _parse_url <ide> <ide> from celery import states <ide><path>celery/backends/rpc.py <ide> <ide> from kombu import Consumer, Exchange, Producer, Queue <ide> from kombu.common import maybe_declare <del>from kombu.utils import cached_property, register_after_fork <add>from kombu.utils.compat import register_after_fork <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import current_task <ide> from celery import states <ide><path>celery/beat.py <ide> from billiard import ensure_multiprocessing <ide> from billiard.context import Process <ide> from billiard.common import reset_signals <del>from kombu.utils import cached_property, reprcall <del>from kombu.utils.functional import maybe_evaluate <add>from kombu.utils.functional import maybe_evaluate, reprcall <add>from kombu.utils.objects import cached_property <ide> <ide> from . import __version__ <ide> from . import platforms <ide><path>celery/bin/multi.py <ide> from subprocess import Popen <ide> from time import sleep <ide> <del>from kombu.utils import cached_property <ide> from kombu.utils.encoding import from_utf8 <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import VERSION_BANNER <ide> from celery.five import items <ide><path>celery/bootsteps.py <ide> from threading import Event <ide> <ide> from kombu.common import ignore_errors <del>from kombu.utils import symbol_by_name <ide> from kombu.utils.encoding import bytes_to_str <add>from kombu.utils.imports import symbol_by_name <ide> <ide> from .five import bytes_if_py2, values, with_metaclass <ide> from .utils.graph import DependencyGraph, GraphFormatter <ide><path>celery/canvas.py <ide> from operator import itemgetter <ide> from itertools import chain as _chain <ide> <del>from kombu.utils import cached_property, fxrange, reprcall, uuid <add>from kombu.utils.functional import fxrange, reprcall <add>from kombu.utils.objects import cached_property <add>from kombu.utils.uuid import uuid <ide> from vine import barrier <ide> <ide> from celery._state import current_app <ide><path>celery/concurrency/__init__.py <ide> # Import from kombu directly as it's used <ide> # early in the import stage, where celery.utils loads <ide> # too much (e.g. for eventlet patching) <del>from kombu.utils import symbol_by_name <add>from kombu.utils.imports import symbol_by_name <ide> <ide> __all__ = ['get_implementation'] <ide> <ide><path>celery/concurrency/asynpool.py <ide> from billiard.queues import _SimpleQueue <ide> from kombu.async import READ, WRITE, ERR <ide> from kombu.serialization import pickle as _pickle <del>from kombu.utils import fxrange <ide> from kombu.utils.eventio import SELECT_BAD_FD <add>from kombu.utils.functional import fxrange <ide> from vine import promise <ide> <ide> from celery.five import Counter, items, values <ide><path>celery/events/__init__.py <ide> from kombu import Exchange, Queue, Producer <ide> from kombu.connection import maybe_channel <ide> from kombu.mixins import ConsumerMixin <del>from kombu.utils import cached_property, uuid <add>from kombu.utils.objects import cached_property <ide> <add>from celery import uuid <ide> from celery.app import app_or_default <ide> from celery.five import items <ide> from celery.utils.functional import dictfilter <ide><path>celery/events/state.py <ide> from weakref import WeakSet, ref <ide> <ide> from kombu.clocks import timetuple <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import states <ide> from celery.five import items, python_2_unicode_compatible, values <ide><path>celery/fixups/django.py <ide> import sys <ide> import warnings <ide> <del>from kombu.utils import cached_property, symbol_by_name <add>from kombu.utils.imports import symbol_by_name <add>from kombu.utils.objects import cached_property <ide> <ide> from datetime import datetime <ide> from importlib import import_module <ide><path>celery/platforms.py <ide> <ide> from billiard.compat import get_fdmax, close_open_fds <ide> # fileno used to be in this module <del>from kombu.utils import maybe_fileno <add>from kombu.utils.compat import maybe_fileno <ide> from kombu.utils.encoding import safe_str <ide> from contextlib import contextmanager <ide> <ide><path>celery/result.py <ide> from contextlib import contextmanager <ide> from copy import copy <ide> <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> from vine import Thenable, barrier, promise <ide> <ide> from . import current_app <ide><path>celery/schedules.py <ide> from collections import Iterable, namedtuple <ide> from datetime import datetime, timedelta <ide> <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> <ide> from . import current_app <ide> from .five import python_2_unicode_compatible, range, string_t <ide><path>celery/tests/case.py <ide> from functools import partial <ide> <ide> from kombu import Queue <del>from kombu.utils import symbol_by_name <add>from kombu.utils.imports import symbol_by_name <ide> from vine.utils import wraps <ide> <ide> from celery import Celery <ide><path>celery/tests/worker/test_control.py <ide> from datetime import datetime, timedelta <ide> <ide> from kombu import pidbox <del>from kombu.utils import uuid <add>from kombu.utils.uuid import uuid <ide> <ide> from celery.five import Queue as FastQueue <ide> from celery.utils.timer2 import Timer <ide><path>celery/tests/worker/test_request.py <ide> from datetime import datetime, timedelta <ide> <ide> from billiard.einfo import ExceptionInfo <del>from kombu.utils import uuid <ide> from kombu.utils.encoding import default_encode, from_utf8, safe_str, safe_repr <add>from kombu.utils.uuid import uuid <ide> <ide> from celery import states <ide> from celery.app.trace import ( <ide><path>celery/tests/worker/test_worker.py <ide> from kombu.common import QoS, ignore_errors <ide> from kombu.transport.base import Message <ide> from kombu.transport.memory import Transport <del>from kombu.utils import uuid <add>from kombu.utils.uuid import uuid <ide> <ide> from celery.bootsteps import RUN, CLOSE, TERMINATE, StartStopStep <ide> from celery.concurrency.base import BasePool <ide><path>celery/utils/__init__.py <ide> instantiate, import_from_cwd, gen_task_name, <ide> ) <ide> from .functional import chunks, noop # noqa <del>from kombu.utils import cached_property, uuid # noqa <add>from kombu.utils.objects import cached_property <add>from kombu.utils.uuid import uuid # noqa <ide> gen_unique_id = uuid <ide><path>celery/utils/imports.py <ide> <ide> from contextlib import contextmanager <ide> <del>from kombu.utils import symbol_by_name <add>from kombu.utils.imports import symbol_by_name <ide> <ide> from celery.five import reload <ide> <ide><path>celery/utils/sysinfo.py <ide> <ide> from math import ceil <ide> <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> <ide> __all__ = ['load_average', 'df'] <ide> <ide><path>celery/utils/timeutils.py <ide> from calendar import monthrange <ide> from datetime import date, datetime, timedelta, tzinfo <ide> <del>from kombu.utils import cached_property, reprcall <add>from kombu.utils.functional import reprcall <add>from kombu.utils.objects import cached_property <ide> <ide> from pytz import timezone as _timezone, AmbiguousTimeError, FixedOffset <ide> <ide><path>celery/worker/request.py <ide> from weakref import ref <ide> <ide> from billiard.common import TERM_SIGNAME <del>from kombu.utils import cached_property <ide> from kombu.utils.encoding import safe_repr, safe_str <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import signals <ide> from celery.app.trace import trace_task, trace_task_ret <ide><path>celery/worker/state.py <ide> import zlib <ide> <ide> from kombu.serialization import pickle, pickle_protocol <del>from kombu.utils import cached_property <add>from kombu.utils.objects import cached_property <ide> <ide> from celery import __version__ <ide> from celery.exceptions import WorkerShutdown, WorkerTerminate
32
Javascript
Javascript
support texture coordinates in ply parser
a889569d4fce1ce6a49d7b1f40502168f6f9139a
<ide><path>examples/js/loaders/PLYLoader.js <ide> THREE.PLYLoader.prototype = { <ide> } else if ( elementName === "face" ) { <ide> <ide> var vertex_indices = element.vertex_indices; <add> var texcoord = element.texcoord; <ide> <ide> if ( vertex_indices.length === 3 ) { <ide> <ide> geometry.faces.push( <ide> new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 2 ] ) <ide> ); <ide> <add> if ( texcoord ) { <add> geometry.faceVertexUvs[ 0 ].push( [ <add> new THREE.Vector2( texcoord[ 0 ], texcoord[ 1 ]), <add> new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]), <add> new THREE.Vector2( texcoord[ 4 ], texcoord[ 5 ]) <add> ] ); <add> } <add> <ide> } else if ( vertex_indices.length === 4 ) { <ide> <ide> geometry.faces.push( <ide> new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 3 ] ), <ide> new THREE.Face3( vertex_indices[ 1 ], vertex_indices[ 2 ], vertex_indices[ 3 ] ) <ide> ); <ide> <add> if ( texcoord ) { <add> geometry.faceVertexUvs[ 0 ].push( [ <add> new THREE.Vector2( texcoord[ 0 ], texcoord[ 1 ]), <add> new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]), <add> new THREE.Vector2( texcoord[ 6 ], texcoord[ 7 ]) <add> ], [ <add> new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]), <add> new THREE.Vector2( texcoord[ 4 ], texcoord[ 5 ]), <add> new THREE.Vector2( texcoord[ 6 ], texcoord[ 7 ]) <add> ] ); <add> } <add> <ide> } <ide> <ide> }
1
Text
Text
add missing period from 4b802bc [ci skip]
214423f40171bf7d3165d70507ab17803b2fbf07
<ide><path>guides/source/3_0_release_notes.md <ide> More Information: <ide> <ide> Major re-write was done in the Action View helpers, implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands. This enables Rails to use any compliant UJS driver to implement the UJS hooks in the helpers. <ide> <del>What this means is that all previous `remote_<method>` helpers have been removed from Rails core and put into the [Prototype Legacy Helper](http://github.com/rails/prototype_legacy_helper) To get UJS hooks into your HTML, you now pass `:remote => true` instead. For example: <add>What this means is that all previous `remote_<method>` helpers have been removed from Rails core and put into the [Prototype Legacy Helper](http://github.com/rails/prototype_legacy_helper). To get UJS hooks into your HTML, you now pass `:remote => true` instead. For example: <ide> <ide> ```ruby <ide> form_for @post, :remote => true
1
Ruby
Ruby
fix version comparison in `sdk#latest_sdk`
6ea9b32f7023b4e70583bd9cc3eb37a783fbb86a
<ide><path>Library/Homebrew/os/mac/sdk.rb <ide> def sdk_for(v) <ide> def latest_sdk <ide> return if sdk_paths.empty? <ide> <del> v, path = sdk_paths.max(&:first) <add> v, path = sdk_paths.max { |(v1, _), (v2, _)| v1 <=> v2 } <ide> SDK.new v, path, source <ide> end <ide>
1
Javascript
Javascript
improve code structure of the annotation code
8b79becad676648ba139acc5189da771060c571e
<ide><path>src/core/annotation.js <ide> */ <ide> /* globals PDFJS, Util, isDict, isName, stringToPDFString, warn, Dict, Stream, <ide> stringToBytes, Promise, isArray, ObjectLoader, OperatorList, <del> isValidUrl, OPS, createPromiseCapability, AnnotationType, <del> stringToUTF8String, AnnotationBorderStyleType, ColorSpace, <del> AnnotationFlag, isInt */ <add> isValidUrl, OPS, AnnotationType, stringToUTF8String, <add> AnnotationBorderStyleType, ColorSpace, AnnotationFlag, isInt */ <ide> <ide> 'use strict'; <ide> <ide> var Annotation = (function AnnotationClosure() { <ide> <ide> function Annotation(params) { <ide> var dict = params.dict; <del> var data = this.data = {}; <del> <del> data.subtype = dict.get('Subtype').name; <ide> <ide> this.setFlags(dict.get('F')); <del> data.annotationFlags = this.flags; <del> <ide> this.setRectangle(dict.get('Rect')); <del> data.rect = this.rectangle; <del> <ide> this.setColor(dict.get('C')); <del> data.color = this.color; <del> <del> this.borderStyle = data.borderStyle = new AnnotationBorderStyle(); <ide> this.setBorderStyle(dict); <del> <ide> this.appearance = getDefaultAppearance(dict); <del> data.hasAppearance = !!this.appearance; <del> data.id = params.ref.num; <add> <add> // Expose public properties using a data object. <add> this.data = {}; <add> this.data.id = params.ref.num; <add> this.data.subtype = dict.get('Subtype').name; <add> this.data.annotationFlags = this.flags; <add> this.data.rect = this.rectangle; <add> this.data.color = this.color; <add> this.data.borderStyle = this.borderStyle; <add> this.data.hasAppearance = !!this.appearance; <ide> } <ide> <ide> Annotation.prototype = { <ide> var Annotation = (function AnnotationClosure() { <ide> * @param {Dict} borderStyle - The border style dictionary <ide> */ <ide> setBorderStyle: function Annotation_setBorderStyle(borderStyle) { <add> this.borderStyle = new AnnotationBorderStyle(); <ide> if (!isDict(borderStyle)) { <ide> return; <ide> } <ide> var Annotation = (function AnnotationClosure() { <ide> }, <ide> <ide> getOperatorList: function Annotation_getOperatorList(evaluator, task) { <del> <ide> if (!this.appearance) { <ide> return Promise.resolve(new OperatorList()); <ide> } <ide> <ide> var data = this.data; <del> <ide> var appearanceDict = this.appearance.dict; <ide> var resourcesPromise = this.loadResources([ <ide> 'ExtGState', <ide> var Annotation = (function AnnotationClosure() { <ide> }; <ide> <ide> Annotation.appendToOperatorList = function Annotation_appendToOperatorList( <del> annotations, opList, pdfManager, partialEvaluator, task, intent) { <del> <del> function reject(e) { <del> annotationsReadyCapability.reject(e); <del> } <del> <del> var annotationsReadyCapability = createPromiseCapability(); <del> <add> annotations, opList, partialEvaluator, task, intent) { <ide> var annotationPromises = []; <ide> for (var i = 0, n = annotations.length; i < n; ++i) { <del> if (intent === 'display' && annotations[i].viewable || <del> intent === 'print' && annotations[i].printable) { <add> if ((intent === 'display' && annotations[i].viewable) || <add> (intent === 'print' && annotations[i].printable)) { <ide> annotationPromises.push( <ide> annotations[i].getOperatorList(partialEvaluator, task)); <ide> } <ide> } <del> Promise.all(annotationPromises).then(function(datas) { <add> return Promise.all(annotationPromises).then(function(operatorLists) { <ide> opList.addOp(OPS.beginAnnotations, []); <del> for (var i = 0, n = datas.length; i < n; ++i) { <del> var annotOpList = datas[i]; <del> opList.addOpList(annotOpList); <add> for (var i = 0, n = operatorLists.length; i < n; ++i) { <add> opList.addOpList(operatorLists[i]); <ide> } <ide> opList.addOp(OPS.endAnnotations, []); <del> annotationsReadyCapability.resolve(); <del> }, reject); <del> <del> return annotationsReadyCapability.promise; <add> }); <ide> }; <ide> <ide> return Annotation; <ide> var AnnotationBorderStyle = (function AnnotationBorderStyleClosure() { <ide> })(); <ide> <ide> var WidgetAnnotation = (function WidgetAnnotationClosure() { <del> <ide> function WidgetAnnotation(params) { <ide> Annotation.call(this, params); <ide> <ide> var TextAnnotation = (function TextAnnotationClosure() { <ide> } <ide> } <ide> <del> Util.inherit(TextAnnotation, Annotation, { }); <add> Util.inherit(TextAnnotation, Annotation, {}); <ide> <ide> return TextAnnotation; <ide> })(); <ide> var LinkAnnotation = (function LinkAnnotationClosure() { <ide> return url; <ide> } <ide> <del> Util.inherit(LinkAnnotation, Annotation, { }); <add> Util.inherit(LinkAnnotation, Annotation, {}); <ide> <ide> return LinkAnnotation; <ide> })(); <ide><path>src/core/core.js <ide> var Page = (function PageClosure() { <ide> } <ide> <ide> var annotationsReadyPromise = Annotation.appendToOperatorList( <del> annotations, pageOpList, pdfManager, partialEvaluator, task, intent); <add> annotations, pageOpList, partialEvaluator, task, intent); <ide> return annotationsReadyPromise.then(function () { <ide> pageOpList.flush(true); <ide> return pageOpList;
2
PHP
PHP
fix coding standards in case/routing
907596b2f5acc0870303f21489c35ceecf7ab6b5
<ide><path>lib/Cake/Test/Case/Routing/DispatcherTest.php <ide> * @package Cake.Test.Case.Routing <ide> */ <ide> class DispatcherMockCakeResponse extends CakeResponse { <add> <ide> protected function _sendHeader($name, $value = null) { <ide> return $name . ' ' . $value; <ide> } <add> <ide> } <ide> <ide> /** <ide> class MyPluginAppController extends AppController { <ide> } <ide> <ide> abstract class DispatcherTestAbstractController extends Controller { <add> <ide> abstract public function index(); <add> <ide> } <ide> <ide> interface DispatcherTestInterfaceController { <add> <ide> public function index(); <add> <ide> } <ide> <ide> /** <ide> public function add() { <ide> public function admin_add($id = null) { <ide> return $id; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function display($page = null) { <ide> public function index() { <ide> return true; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function admin_index() { <ide> public function camelCased() { <ide> return true; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function admin_index() { <ide> public function index() { <ide> return true; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function index() { <ide> public function change() { <ide> return true; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function themed() { <ide> $this->viewClass = 'Theme'; <ide> $this->theme = 'TestTheme'; <ide> } <add> <ide> } <ide> <ide> /** <ide> class TimesheetsController extends Controller { <ide> public function index() { <ide> return true; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function testMissingControllerAbstract() { <ide> */ <ide> public function testDispatchBasic() { <ide> App::build(array( <del> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) <add> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) <ide> )); <ide> $Dispatcher = new TestDispatcher(); <ide> Configure::write('App.baseUrl', '/index.php'); <ide> public function testAutomaticPluginControllerDispatch() { <ide> $this->assertSame($controller->action, 'add'); <ide> $this->assertEquals($controller->params['named'], array('param' => 'value', 'param2' => 'value2')); <ide> <del> <ide> Router::reload(); <ide> require CAKE . 'Config' . DS . 'routes.php'; <ide> $Dispatcher = new TestDispatcher(); <ide> public function testAutomaticPluginControllerDispatch() { <ide> $expected = $pluginUrl; <ide> $this->assertEquals($controller->params['controller'], $expected); <ide> <del> <ide> Configure::write('Routing.prefixes', array('admin')); <ide> <ide> Router::reload(); <ide> public function testAutomaticPluginControllerDispatch() { <ide> 'plugin' => 'articles_test', <ide> 'action' => 'admin_index', <ide> 'prefix' => 'admin', <del> 'admin' => true, <add> 'admin' => true, <ide> 'return' => 1 <ide> ); <ide> foreach ($expected as $key => $value) { <ide> public function testAssets() { <ide> <ide> App::build(array( <ide> 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), <del> 'Vendor' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor'. DS), <del> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) <add> 'Vendor' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS), <add> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) <ide> )); <ide> CakePlugin::load(array('TestPlugin', 'TestPluginTwo')); <ide> <ide> public function testAsset($url, $file) { <ide> <ide> App::build(array( <ide> 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), <del> 'Vendor' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor'. DS), <del> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) <add> 'Vendor' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS), <add> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) <ide> )); <ide> CakePlugin::load(array('TestPlugin', 'PluginJs')); <ide> <ide> public function testAsset($url, $file) { <ide> $Dispatcher->dispatch(new CakeRequest($url), $response); <ide> $result = ob_get_clean(); <ide> <del> $path = CAKE. 'Test' . DS . 'test_app' . DS . str_replace('/', DS, $file); <add> $path = CAKE . 'Test' . DS . 'test_app' . DS . str_replace('/', DS, $file); <ide> $file = file_get_contents($path); <ide> $this->assertEquals($file, $result); <ide> <ide><path>lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php <ide> * @package Cake.Test.Case.Routing.Route <ide> **/ <ide> class CakeRouteTest extends CakeTestCase { <add> <ide> /** <ide> * setUp method <ide> * <ide> public function testComplexRouteCompilingAndParsing() { <ide> $this->assertEquals($result['day'], '01'); <ide> $this->assertEquals($result['pass'][0], 'title-of-post'); <ide> <del> <ide> $route = new CakeRoute( <ide> "/:extra/page/:slug/*", <ide> array('controller' => 'pages', 'action' => 'view', 'extra' => null), <ide> public function testMatchBasic() { <ide> $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'about')); <ide> $this->assertFalse($result); <ide> <del> <ide> $route = new CakeRoute('/pages/*', array('controller' => 'pages', 'action' => 'display')); <ide> $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'home')); <ide> $this->assertEquals($result, '/pages/home'); <ide> <ide> $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'about')); <ide> $this->assertEquals($result, '/pages/about'); <ide> <del> <ide> $route = new CakeRoute('/blog/:action', array('controller' => 'posts')); <ide> $result = $route->match(array('controller' => 'posts', 'action' => 'view')); <ide> $this->assertEquals($result, '/blog/view'); <ide> public function testMatchBasic() { <ide> $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'id' => 2)); <ide> $this->assertFalse($result); <ide> <del> <ide> $route = new CakeRoute('/foo/:controller/:action', array('action' => 'index')); <ide> $result = $route->match(array('controller' => 'posts', 'action' => 'view')); <ide> $this->assertEquals($result, '/foo/posts/view'); <ide> <del> <ide> $route = new CakeRoute('/:plugin/:id/*', array('controller' => 'posts', 'action' => 'view')); <ide> $result = $route->match(array('plugin' => 'test', 'controller' => 'posts', 'action' => 'view', 'id' => '1')); <ide> $this->assertEquals($result, '/test/1/'); <ide> public function testMatchBasic() { <ide> $result = $route->match(array('plugin' => 'fo', 'controller' => 'posts', 'action' => 'edit', 'id' => 1)); <ide> $this->assertFalse($result); <ide> <del> <ide> $route = new CakeRoute('/admin/subscriptions/:action/*', array( <ide> 'controller' => 'subscribe', 'admin' => true, 'prefix' => 'admin' <ide> )); <ide> public function testParseTrailing() { <ide> * Test the /** special type on parsing - UTF8. <ide> * <ide> * @return void <del> */ <del> <add> */ <ide> public function testParseTrailingUTF8() { <ide> $route = new CakeRoute( '/category/**', array('controller' => 'categories','action' => 'index')); <ide> $result = $route->parse('/category/%D9%85%D9%88%D8%A8%D8%A7%DB%8C%D9%84'); <ide> public function testParseTrailingUTF8() { <ide> 'named' => array() <ide> ); <ide> $this->assertEquals($expected, $result); <add> } <ide> <del> } <ide> } <ide><path>lib/Cake/Test/Case/Routing/Route/PluginShortRouteTest.php <ide> <ide> App::uses('PluginShortRoute', 'Routing/Route'); <ide> App::uses('Router', 'Routing'); <add> <ide> /** <ide> * test case for PluginShortRoute <ide> * <ide> * @package Cake.Test.Case.Routing.Route <ide> */ <ide> class PluginShortRouteTestCase extends CakeTestCase { <add> <ide> /** <ide> * setUp method <ide> * <ide><path>lib/Cake/Test/Case/Routing/Route/RedirectRouteTest.php <ide> * @package Cake.Test.Case.Routing.Route <ide> */ <ide> class RedirectRouteTestCase extends CakeTestCase { <add> <ide> /** <ide> * setUp method <ide> * <ide><path>lib/Cake/Test/Case/Routing/RouterTest.php <ide> public function testUrlGenerationWithAdminPrefix() { <ide> $expected = '/magazine/admin/users/login'; <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> Router::reload(); <ide> $request = new CakeRequest(); <ide> $request->addParams(array( <ide> public function testUrlGenerationWithAdminPrefix() { <ide> $expected = '/admin/pages/add'; <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> Router::reload(); <ide> Router::parse('/'); <ide> $request = new CakeRequest(); <ide> public function testUrlGenerationWithAdminPrefix() { <ide> $expected = '/admin/pages/edit/284'; <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> Router::reload(); <ide> Router::parse('/'); <ide> <ide> public function testUrlGenerationWithAdminPrefix() { <ide> $expected = '/admin/pages/add'; <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> Router::reload(); <ide> Router::parse('/'); <ide> <ide> public function testUrlGenerationWithAdminPrefix() { <ide> $expected = '/admin/pages/edit/284'; <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> Router::reload(); <ide> Router::connect('/admin/posts/*', array('controller' => 'posts', 'action' => 'index', 'admin' => true)); <ide> Router::parse('/'); <ide> public function testPersistentParameters() { <ide> Router::connect('/about', array('controller' => 'pages', 'action' => 'view', 'about')); <ide> Router::parse('/en/red/posts/view/5'); <ide> <del> <ide> $request = new CakeRequest(); <ide> Router::setRequestInfo( <ide> $request->addParams(array( <ide> public function testPrefixRoutingAndPlugins() { <ide> Configure::write('Routing.prefixes', array('admin')); <ide> $paths = App::path('plugins'); <ide> App::build(array( <del> 'plugins' => array( <add> 'plugins' => array( <ide> CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS <ide> ) <ide> ), App::RESET); <ide> public function testQuerystringGeneration() { <ide> $result = Router::url(array('controller' => 'posts', 'action' => 'index', '0', '?' => array('var' => 'test', 'var2' => 'test2', 'more' => 'test data'))); <ide> $this->assertEquals($expected, $result); <ide> <del>// Test bug #4614 <add> // Test bug #4614 <ide> $restore = ini_get('arg_separator.output'); <ide> ini_set('arg_separator.output', '&amp;'); <ide> $result = Router::url(array('controller' => 'posts', 'action' => 'index', '0', '?' => array('var' => 'test', 'var2' => 'test2', 'more' => 'test data'))); <ide> public function testDefaultsMethod() { <ide> */ <ide> public function testConnectDefaultRoutes() { <ide> App::build(array( <del> 'plugins' => array( <add> 'plugins' => array( <ide> CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS <ide> ) <ide> ), App::RESET); <ide> public function testResourceMap() { <ide> array('action' => 'edit', 'method' => 'POST', 'id' => true) <ide> ); <ide> $this->assertEquals($default, $exepcted); <del> <add> <ide> $custom = array( <ide> array('action' => 'index', 'method' => 'GET', 'id' => false), <ide> array('action' => 'view', 'method' => 'GET', 'id' => true), <ide> public function testResourceMap() { <ide> ); <ide> Router::resourceMap($custom); <ide> $this->assertEquals($custom, Router::resourceMap()); <del> <add> <ide> Router::resourceMap($default); <ide> } <ide>
5
Text
Text
replace triple dot character with real dots
13a4d29bf135a80ae13589df82ac16dad6e6e092
<ide><path>docs/migrating/from-create-react-app.md <ide> export default function SEO({ description, title, siteTitle }) { <ide> <ide> ## Single-Page App (SPA) <ide> <del>If you want to move your existing Create React App to Next.js and keep a Single-Page App, you can move your old application's entry point to an [Optional Catch-All Route](/docs/routing/dynamic-routes.md#optional-catch-all-routes) named `pages/[[…app]].js`. <add>If you want to move your existing Create React App to Next.js and keep a Single-Page App, you can move your old application's entry point to an [Optional Catch-All Route](/docs/routing/dynamic-routes.md#optional-catch-all-routes) named `pages/[[...app]].js`. <ide> <ide> ```jsx <ide> // pages/[[...app]].js
1
PHP
PHP
allow releasing jobs
0ae4b029f54f02fab724d21dea01fe426fb8f01a
<ide><path>src/Illuminate/Queue/Jobs/SqsJob.php <ide> public function release($delay = 0) <ide> { <ide> parent::release($delay); <ide> <del> // SQS job releases are handled by the server configuration... <add> $this->sqs->changeMessageVisibility([ <add> 'QueueUrl' => $this->queue, <add> 'ReceiptHandle' => $this->job['ReceiptHandle'], <add> 'VisibilityTimeout' => $delay, <add> ]); <ide> } <ide> <ide> /**
1
Text
Text
use relative linking
2e8b0366dc4970bb651bd57ddaf0665d811d2e1e
<ide><path>docs/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md 'Contribute to the freeCodeCamp.org Community') <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <ide> - [Frequently Asked Questions](/FAQ.md) <ide> - **Code Contribution** <ide> - - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <ide><path>docs/i18n/Afrikaans/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index) <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Arabic/_sidebar.md <ide> - **بدء العمل** <del> - [مقدمة](/index.md "المساهمة في مجتمع FreCodeCamp.org") <del> - [الأسئلة المتكررة](/FAQ.md) <add> - [مقدمة](index 'المساهمة في مجتمع FreCodeCamp.org') <add> - [الأسئلة المتكررة](FAQ.md) <ide> - **مساهمة الرمز** <del>- - [إعداد FreCodeCamp محليا](/how-to-setup-freecodecamp-locally.md) <del> - [فتح طلب سحب](/how-to-open-a-pull-request.md) <del> - [العمل على تحديات البرمجة](/how-to-work-on-coding-challenges.md) <del> - [العمل المتعلق بتحديات الفيديو](/how-to-help-with-video-challenges.md) <del> - [العمل المتعلق بموضوع الأخبار](/how-to-work-on-the-news-theme.md) <del> - [العمل في موضوع المستندات](/how-to-work-on-the-docs-theme.md) <add>- - [إعداد FreCodeCamp محليا](how-to-setup-freecodecamp-locally.md) <add> - [فتح طلب سحب](how-to-open-a-pull-request.md) <add> - [العمل على تحديات البرمجة](how-to-work-on-coding-challenges.md) <add> - [العمل المتعلق بتحديات الفيديو](how-to-help-with-video-challenges.md) <add> - [العمل المتعلق بموضوع الأخبار](how-to-work-on-the-news-theme.md) <add> - [العمل في موضوع المستندات](how-to-work-on-the-docs-theme.md) <ide> - **أدلة اختيارية** <del> - [التقط رسائل البريد الإلكتروني الصادرة محليا](/how-to-catch-outgoing-emails-locally.md) <del> - [إعداد freeCodeCamp على WSL](/how-to-setup-wsl.md) <add> - [التقط رسائل البريد الإلكتروني الصادرة محليا](how-to-catch-outgoing-emails-locally.md) <add> - [إعداد freeCodeCamp على WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **دليل الرحلات الجوية** (للموظفين & موحد) <del> - [دليل المشرف](/flight-manuals/moderator-handbook.md) <del> - [قوالب الرد](/flight-manuals/using-reply-templates.md) <del> - [استعراض DevOps](/devops.md) <del> - [العمل على الخوادم](/flight-manuals/working-on-virtual-machines.md) <add> - [دليل المشرف](flight-manuals/moderator-handbook.md) <add> - [قوالب الرد](flight-manuals/using-reply-templates.md) <add> - [استعراض DevOps](devops.md) <add> - [العمل على الخوادم](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Catalan/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Chinese/_sidebar.md <ide> - **正在开始** <del> - [一. 导言](/index.md "为FreeCodeCamp.org 社区贡献") <del> - [常见问题](/FAQ.md) <add> - [一. 导言](index '为FreeCodeCamp.org 社区贡献') <add> - [常见问题](FAQ.md) <ide> - **代码贡献** <del>- - [在本地设置免费CodeCamp](/how-to-setup-freecodecamp-locally.md) <del> - [打开拉取请求](/how-to-open-a-pull-request.md) <del> - [关于编码挑战的工作](/how-to-work-on-coding-challenges.md) <del> - [关于视频挑战的工作](/how-to-help-with-video-challenges.md) <del> - [关于新闻主题的工作](/how-to-work-on-the-news-theme.md) <del> - [关于文件主题的工作](/how-to-work-on-the-docs-theme.md) <add>- - [在本地设置免费 CodeCamp](how-to-setup-freecodecamp-locally.md) <add> - [打开拉取请求](how-to-open-a-pull-request.md) <add> - [关于编码挑战的工作](how-to-work-on-coding-challenges.md) <add> - [关于视频挑战的工作](how-to-help-with-video-challenges.md) <add> - [关于新闻主题的工作](how-to-work-on-the-news-theme.md) <add> - [关于文件主题的工作](how-to-work-on-the-docs-theme.md) <ide> - **可选指南** <del> - [捕获本地发送的电子邮件](/how-to-catch-outgoing-emails-locally.md) <del> - [在 WSL 上设置免费CodeCamp](/how-to-setup-wsl.md) <add> - [捕获本地发送的电子邮件](how-to-catch-outgoing-emails-locally.md) <add> - [在 WSL 上设置免费 CodeCamp](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **飞行手册** (适合员 & 模式) <del> - [版主手册](/flight-manuals/moderator-handbook.md) <del> - [回复模板](/flight-manuals/using-reply-templates.md) <del> - [DevOps 概述](/devops.md) <del> - [在服务器上工作](/flight-manuals/working-on-virtual-machines.md) <add> - [版主手册](flight-manuals/moderator-handbook.md) <add> - [回复模板](flight-manuals/using-reply-templates.md) <add> - [DevOps 概述](devops.md) <add> - [在服务器上工作](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Czech/_sidebar.md <ide> - **Začněme** <del> - [Úvod](/index.md "Přispějte do komunity freeCodeCamp.org") <del> - [Často kladené otázky](/FAQ.md) <add> - [Úvod](index 'Přispějte do komunity freeCodeCamp.org') <add> - [Často kladené otázky](FAQ.md) <ide> - **Přispění kódu** <del>- - [Nastavte volný CodeCamp lokálně](/how-to-setup-freecodecamp-locally.md) <del> - [Otevřít požadavek na natažení](/how-to-open-a-pull-request.md) <del> - [Práce na výzvách v kódování](/how-to-work-on-coding-challenges.md) <del> - [Pracovat na výzvách spojených s videem](/how-to-help-with-video-challenges.md) <del> - [Práce na tématu novinek](/how-to-work-on-the-news-theme.md) <del> - [Práce na motivu dokumentace](/how-to-work-on-the-docs-theme.md) <add>- - [Nastavte volný CodeCamp lokálně](how-to-setup-freecodecamp-locally.md) <add> - [Otevřít požadavek na natažení](how-to-open-a-pull-request.md) <add> - [Práce na výzvách v kódování](how-to-work-on-coding-challenges.md) <add> - [Pracovat na výzvách spojených s videem](how-to-help-with-video-challenges.md) <add> - [Práce na tématu novinek](how-to-work-on-the-news-theme.md) <add> - [Práce na motivu dokumentace](how-to-work-on-the-docs-theme.md) <ide> - **Volitelné návody** <del> - [Ukládat odchozí e-maily lokálně](/how-to-catch-outgoing-emails-locally.md) <del> - [Nastavit freeCodeCamp na WSL](/how-to-setup-wsl.md) <add> - [Ukládat odchozí e-maily lokálně](how-to-catch-outgoing-emails-locally.md) <add> - [Nastavit freeCodeCamp na WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Letové příručky** (pro zaměstnance & režimy) <del> - [Moderátor příručka](/flight-manuals/moderator-handbook.md) <del> - [Šablony odpovědí](/flight-manuals/using-reply-templates.md) <del> - [Přehled DevOps](/devops.md) <del> - [Práce na serverech](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderátor příručka](flight-manuals/moderator-handbook.md) <add> - [Šablony odpovědí](flight-manuals/using-reply-templates.md) <add> - [Přehled DevOps](devops.md) <add> - [Práce na serverech](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Danish/_sidebar.md <ide> - **Kom I Gang** <del> - [Indledning](/index.md "Bidrag til freeCodeCamp.org Fællesskabet") <del> - [Ofte Stillede Spørgsmål](/FAQ.md) <add> - [Indledning](index 'Bidrag til freeCodeCamp.org Fællesskabet') <add> - [Ofte Stillede Spørgsmål](FAQ.md) <ide> - **Kode Bidrag** <del>- - [Opsæt freeCodeCamp lokalt](/how-to-setup-freecodecamp-locally.md) <del> - [Åbn en pull-anmodning](/how-to-open-a-pull-request.md) <del> - [Arbejde med kodningsudfordringer](/how-to-work-on-coding-challenges.md) <del> - [Arbejde med videoudfordringer](/how-to-help-with-video-challenges.md) <del> - [Arbejd på nyheder tema](/how-to-work-on-the-news-theme.md) <del> - [Arbejde på dokument-temaet](/how-to-work-on-the-docs-theme.md) <add>- - [Opsæt freeCodeCamp lokalt](how-to-setup-freecodecamp-locally.md) <add> - [Åbn en pull-anmodning](how-to-open-a-pull-request.md) <add> - [Arbejde med kodningsudfordringer](how-to-work-on-coding-challenges.md) <add> - [Arbejde med videoudfordringer](how-to-help-with-video-challenges.md) <add> - [Arbejd på nyheder tema](how-to-work-on-the-news-theme.md) <add> - [Arbejde på dokument-temaet](how-to-work-on-the-docs-theme.md) <ide> - **Valgfrie Guider** <del> - [Fang udgående e-mails lokalt](/how-to-catch-outgoing-emails-locally.md) <del> - [Konfigurer freeCodeCamp på WSL](/how-to-setup-wsl.md) <add> - [Fang udgående e-mails lokalt](how-to-catch-outgoing-emails-locally.md) <add> - [Konfigurer freeCodeCamp på WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flyvemanualer** (for medarbejdere & møder) <del> - [Moderator Håndbog](/flight-manuals/moderator-handbook.md) <del> - [Svar Skabeloner](/flight-manuals/using-reply-templates.md) <del> - [Oversigt Over DevOps](/devops.md) <del> - [Arbejder på servere](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Håndbog](flight-manuals/moderator-handbook.md) <add> - [Svar Skabeloner](flight-manuals/using-reply-templates.md) <add> - [Oversigt Over DevOps](devops.md) <add> - [Arbejder på servere](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Dutch/_sidebar.md <ide> - **Aan de slag** <del> - [Introductie](/index.md "Draag bij aan de freeCodeCamp.org Gemeenschap") <del> - [Veelgestelde vragen (FAQ's)](/FAQ.md) <add> - [Introductie](index 'Draag bij aan de freeCodeCamp.org Gemeenschap') <add> - [Veelgestelde vragen (FAQ's)](FAQ.md) <ide> - **Code bijdrage** <del>- - [Stel het freeCodeCamp lokaal in](/how-to-setup-freecodecamp-locally.md) <del> - [Open een pull-aanvraag](/how-to-open-a-pull-request.md) <del> - [Werk aan coderingsuitdagingen](/how-to-work-on-coding-challenges.md) <del> - [Werk aan video uitdagingen](/how-to-help-with-video-challenges.md) <del> - [Werk aan het nieuws thema](/how-to-work-on-the-news-theme.md) <del> - [Werk aan het thema documenten](/how-to-work-on-the-docs-theme.md) <add>- - [Stel het freeCodeCamp lokaal in](how-to-setup-freecodecamp-locally.md) <add> - [Open een pull-aanvraag](how-to-open-a-pull-request.md) <add> - [Werk aan coderingsuitdagingen](how-to-work-on-coding-challenges.md) <add> - [Werk aan video uitdagingen](how-to-help-with-video-challenges.md) <add> - [Werk aan het nieuws thema](how-to-work-on-the-news-theme.md) <add> - [Werk aan het thema documenten](how-to-work-on-the-docs-theme.md) <ide> - **Optionele handleidingen** <del> - [Groeps uitgaande e-mails lokaal](/how-to-catch-outgoing-emails-locally.md) <del> - [Gratis CodeCamp op WSL instellen](/how-to-setup-wsl.md) <add> - [Groeps uitgaande e-mails lokaal](how-to-catch-outgoing-emails-locally.md) <add> - [Gratis CodeCamp op WSL instellen](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Vlucht handleidingen** (voor medewerkers & Mods) <del> - [Moderator handboek](/flight-manuals/moderator-handbook.md) <del> - [Antwoord sjablonen](/flight-manuals/using-reply-templates.md) <del> - [DevOps overzicht](/devops.md) <del> - [Werken aan servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator handboek](flight-manuals/moderator-handbook.md) <add> - [Antwoord sjablonen](flight-manuals/using-reply-templates.md) <add> - [DevOps overzicht](devops.md) <add> - [Werken aan servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Finnish/_sidebar.md <ide> - **Aloittaminen** <del> - [Johdanto](/index.md "Osallistu freeCodeCamp.org -yhteisöön") <del> - [Usein Kysytyt Kysymykset](/FAQ.md) <add> - [Johdanto](index 'Osallistu freeCodeCamp.org -yhteisöön') <add> - [Usein Kysytyt Kysymykset](FAQ.md) <ide> - **Koodin Rahoitusosuus** <del>- - [Aseta freeCodeCamp paikallisesti](/how-to-setup-freecodecamp-locally.md) <del> - [Avaa pull-pyyntö](/how-to-open-a-pull-request.md) <del> - [Koodaukseen liittyviä haasteita koskeva työ](/how-to-work-on-coding-challenges.md) <del> - [Videohaasteisiin liittyvä työ](/how-to-help-with-video-challenges.md) <del> - [Työ uutisaiheen parissa](/how-to-work-on-the-news-theme.md) <del> - [Työskentele dokumenttien teemassa](/how-to-work-on-the-docs-theme.md) <add>- - [Aseta freeCodeCamp paikallisesti](how-to-setup-freecodecamp-locally.md) <add> - [Avaa pull-pyyntö](how-to-open-a-pull-request.md) <add> - [Koodaukseen liittyviä haasteita koskeva työ](how-to-work-on-coding-challenges.md) <add> - [Videohaasteisiin liittyvä työ](how-to-help-with-video-challenges.md) <add> - [Työ uutisaiheen parissa](how-to-work-on-the-news-theme.md) <add> - [Työskentele dokumenttien teemassa](how-to-work-on-the-docs-theme.md) <ide> - **Valinnaiset Oppaat** <del> - [Saaliin lähtevät sähköpostit paikallisesti](/how-to-catch-outgoing-emails-locally.md) <del> - [Määritä freeCodeCamp WSL](/how-to-setup-wsl.md) <add> - [Saaliin lähtevät sähköpostit paikallisesti](how-to-catch-outgoing-emails-locally.md) <add> - [Määritä freeCodeCamp WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Lentokäsikirjat** (henkilökunta & Modit) <del> - [Moderaattorin Käsikirja](/flight-manuals/moderator-handbook.md) <del> - [Vastaa Mallit](/flight-manuals/using-reply-templates.md) <del> - [DevOPS-yleiskatsaus](/devops.md) <del> - [Palvelimia koskeva työskentely](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderaattorin Käsikirja](flight-manuals/moderator-handbook.md) <add> - [Vastaa Mallit](flight-manuals/using-reply-templates.md) <add> - [DevOPS-yleiskatsaus](devops.md) <add> - [Palvelimia koskeva työskentely](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/French/_sidebar.md <ide> - **Commencer** <del> - [Introduction](/index.md "Contribuer à la communauté freeCodeCamp.org") <del> - [Foire aux questions](/FAQ.md) <add> - [Introduction](index 'Contribuer à la communauté freeCodeCamp.org') <add> - [Foire aux questions](FAQ.md) <ide> - **Contribution au code** <del>- - [Mettre en place freeCodeCamp localement](/how-to-setup-freecodecamp-locally.md) <del> - [Ouvrir une pull request](/how-to-open-a-pull-request.md) <del> - [Travailler sur les défis de codage](/how-to-work-on-coding-challenges.md) <del> - [Travailler sur les défis vidéo](/how-to-help-with-video-challenges.md) <del> - [Travailler sur le thème des nouvelles](/how-to-work-on-the-news-theme.md) <del> - [Travailler sur le thème docs](/how-to-work-on-the-docs-theme.md) <add>- - [Mettre en place freeCodeCamp localement](how-to-setup-freecodecamp-locally.md) <add> - [Ouvrir une pull request](how-to-open-a-pull-request.md) <add> - [Travailler sur les défis de codage](how-to-work-on-coding-challenges.md) <add> - [Travailler sur les défis vidéo](how-to-help-with-video-challenges.md) <add> - [Travailler sur le thème des nouvelles](how-to-work-on-the-news-theme.md) <add> - [Travailler sur le thème docs](how-to-work-on-the-docs-theme.md) <ide> - **Tutoriels optionnels** <del> - [Attrape les e-mails sortants localement](/how-to-catch-outgoing-emails-locally.md) <del> - [Configurer freeCodeCamp sur WSL](/how-to-setup-wsl.md) <add> - [Attrape les e-mails sortants localement](how-to-catch-outgoing-emails-locally.md) <add> - [Configurer freeCodeCamp sur WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Manuels de vol** (pour le personnel & Mods) <del> - [Manuel de Modérateur](/flight-manuals/moderator-handbook.md) <del> - [Modèles de réponse](/flight-manuals/using-reply-templates.md) <del> - [Vue d'ensemble de DevOps](/devops.md) <del> - [Travailler sur les serveurs](/flight-manuals/working-on-virtual-machines.md) <add> - [Manuel de Modérateur](flight-manuals/moderator-handbook.md) <add> - [Modèles de réponse](flight-manuals/using-reply-templates.md) <add> - [Vue d'ensemble de DevOps](devops.md) <add> - [Travailler sur les serveurs](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/German/_sidebar.md <ide> - **Erste Schritte** <del> - [Einführung](/index.md "Zur FreeCodeCamp.org Community beitragen") <del> - [Häufig gestellte Fragen](/FAQ.md) <add> - [Einführung](index 'Zur FreeCodeCamp.org Community beitragen') <add> - [Häufig gestellte Fragen](FAQ.md) <ide> - **Code-Beitrag** <del>- - [FreeCodeCamp lokal einrichten](/how-to-setup-freecodecamp-locally.md) <del> - [Pull-Request öffnen](/how-to-open-a-pull-request.md) <del> - [Arbeit an Codierungsaufgaben](/how-to-work-on-coding-challenges.md) <del> - [Arbeiten an Videoherausforderungen](/how-to-help-with-video-challenges.md) <del> - [Arbeiten Sie am News-Thema](/how-to-work-on-the-news-theme.md) <del> - [Arbeiten Sie mit dem Thema Dokumentation](/how-to-work-on-the-docs-theme.md) <add>- - [FreeCodeCamp lokal einrichten](how-to-setup-freecodecamp-locally.md) <add> - [Pull-Request öffnen](how-to-open-a-pull-request.md) <add> - [Arbeit an Codierungsaufgaben](how-to-work-on-coding-challenges.md) <add> - [Arbeiten an Videoherausforderungen](how-to-help-with-video-challenges.md) <add> - [Arbeiten Sie am News-Thema](how-to-work-on-the-news-theme.md) <add> - [Arbeiten Sie mit dem Thema Dokumentation](how-to-work-on-the-docs-theme.md) <ide> - **Optionale Anleitungen** <del> - [Abgehende E-Mails lokal auffangen](/how-to-catch-outgoing-emails-locally.md) <del> - [FreeCodeCamp auf WSL einrichten](/how-to-setup-wsl.md) <add> - [Abgehende E-Mails lokal auffangen](how-to-catch-outgoing-emails-locally.md) <add> - [FreeCodeCamp auf WSL einrichten](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flughandbücher** (für Personal & Mods) <del> - [Moderatorhandbuch](/flight-manuals/moderator-handbook.md) <del> - [Antwortvorlagen](/flight-manuals/using-reply-templates.md) <del> - [DevOps Übersicht](/devops.md) <del> - [Arbeiten auf Servern](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderatorhandbuch](flight-manuals/moderator-handbook.md) <add> - [Antwortvorlagen](flight-manuals/using-reply-templates.md) <add> - [DevOps Übersicht](devops.md) <add> - [Arbeiten auf Servern](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Greek/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Hebrew/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Hindi/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Hungarian/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Italian/_sidebar.md <ide> - **Per Iniziare** <del> - [Introduzione](/index.md "Contribuire alla comunità freeCodeCamp.org") <del> - [Domande Frequenti](/FAQ.md) <add> - [Introduzione](index 'Contribuire alla comunità freeCodeCamp.org') <add> - [Domande Frequenti](FAQ.md) <ide> - **Contributo Al Codice** <del>- - [Configura il freeCodeCamp localmente](/how-to-setup-freecodecamp-locally.md) <del> - [Apri una pull request](/how-to-open-a-pull-request.md) <del> - [Lavori sulle sfide della codifica](/how-to-work-on-coding-challenges.md) <del> - [Lavorare sulle sfide del video](/how-to-help-with-video-challenges.md) <del> - [Lavori sul tema delle notizie](/how-to-work-on-the-news-theme.md) <del> - [Lavora sul tema dei documenti](/how-to-work-on-the-docs-theme.md) <add>- - [Configura il freeCodeCamp localmente](how-to-setup-freecodecamp-locally.md) <add> - [Apri una pull request](how-to-open-a-pull-request.md) <add> - [Lavori sulle sfide della codifica](how-to-work-on-coding-challenges.md) <add> - [Lavorare sulle sfide del video](how-to-help-with-video-challenges.md) <add> - [Lavori sul tema delle notizie](how-to-work-on-the-news-theme.md) <add> - [Lavora sul tema dei documenti](how-to-work-on-the-docs-theme.md) <ide> - **Guide Opzionali** <del> - [Cattura le email in uscita localmente](/how-to-catch-outgoing-emails-locally.md) <del> - [Impostare freeCodeCamp su WSL](/how-to-setup-wsl.md) <add> - [Cattura le email in uscita localmente](how-to-catch-outgoing-emails-locally.md) <add> - [Impostare freeCodeCamp su WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Manuali di volo** (per il personale & Mod) <del> - [Manuale Moderatore](/flight-manuals/moderator-handbook.md) <del> - [Modelli Di Risposta](/flight-manuals/using-reply-templates.md) <del> - [Panoramica DevOps](/devops.md) <del> - [Lavorare sui server](/flight-manuals/working-on-virtual-machines.md) <add> - [Manuale Moderatore](flight-manuals/moderator-handbook.md) <add> - [Modelli Di Risposta](flight-manuals/using-reply-templates.md) <add> - [Panoramica DevOps](devops.md) <add> - [Lavorare sui server](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Japanese/_sidebar.md <ide> - **はじめに** <del> - [はじめに](/index.md "freeCodeCamp.org コミュニティに貢献する") <del> - [よく寄せられる質問](/FAQ.md) <add> - [はじめに](index 'freeCodeCamp.org コミュニティに貢献する') <add> - [よく寄せられる質問](FAQ.md) <ide> - **コード貢献** <del>- - [freeCodeCampをローカルで設定](/how-to-setup-freecodecamp-locally.md) <del> - [プルリクエストを開く](/how-to-open-a-pull-request.md) <del> - [コーディングの課題に取り組むこと](/how-to-work-on-coding-challenges.md) <del> - [ビデオの課題に取り組むこと](/how-to-help-with-video-challenges.md) <del> - [ニュースのテーマを操作する](/how-to-work-on-the-news-theme.md) <del> - [ドキュメントのテーマを操作する](/how-to-work-on-the-docs-theme.md) <add>- - [freeCodeCamp をローカルで設定](how-to-setup-freecodecamp-locally.md) <add> - [プルリクエストを開く](how-to-open-a-pull-request.md) <add> - [コーディングの課題に取り組むこと](how-to-work-on-coding-challenges.md) <add> - [ビデオの課題に取り組むこと](how-to-help-with-video-challenges.md) <add> - [ニュースのテーマを操作する](how-to-work-on-the-news-theme.md) <add> - [ドキュメントのテーマを操作する](how-to-work-on-the-docs-theme.md) <ide> - **オプションガイド** <del> - [ローカルで送信メールをキャッチする](/how-to-catch-outgoing-emails-locally.md) <del> - [WSLでfreeCodeCampを設定](/how-to-setup-wsl.md) <add> - [ローカルで送信メールをキャッチする](how-to-catch-outgoing-emails-locally.md) <add> - [WSL で freeCodeCamp を設定](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <del>- **フライトマニュアル** (スタッフ & Mod用) <del> - [モデレーターハンドブック](/flight-manuals/moderator-handbook.md) <del> - [返信テンプレート](/flight-manuals/using-reply-templates.md) <del> - [DevOps の概要](/devops.md) <del> - [サーバーでの作業](/flight-manuals/working-on-virtual-machines.md) <add>- **フライトマニュアル** (スタッフ & Mod 用) <add> - [モデレーターハンドブック](flight-manuals/moderator-handbook.md) <add> - [返信テンプレート](flight-manuals/using-reply-templates.md) <add> - [DevOps の概要](devops.md) <add> - [サーバーでの作業](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Korean/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Norwegian/_sidebar.md <ide> - **Komme i gang** <del> - [Introduksjon](/index.md "Bidra til freeCodeCamp.org samfunnet") <del> - [Ofte stilte spørsmål](/FAQ.md) <add> - [Introduksjon](index 'Bidra til freeCodeCamp.org samfunnet') <add> - [Ofte stilte spørsmål](FAQ.md) <ide> - **Bidrag til kode** <del>- - [Sett opp freeCodeCamp lokalt](/how-to-setup-freecodecamp-locally.md) <del> - [Åpne pull-forespørsel](/how-to-open-a-pull-request.md) <del> - [Arbeid med kodeutfordringer](/how-to-work-on-coding-challenges.md) <del> - [Arbeid med videoutfordringer](/how-to-help-with-video-challenges.md) <del> - [Arbeid med nyhetstema](/how-to-work-on-the-news-theme.md) <del> - [Arbeid med tema i doks](/how-to-work-on-the-docs-theme.md) <add>- - [Sett opp freeCodeCamp lokalt](how-to-setup-freecodecamp-locally.md) <add> - [Åpne pull-forespørsel](how-to-open-a-pull-request.md) <add> - [Arbeid med kodeutfordringer](how-to-work-on-coding-challenges.md) <add> - [Arbeid med videoutfordringer](how-to-help-with-video-challenges.md) <add> - [Arbeid med nyhetstema](how-to-work-on-the-news-theme.md) <add> - [Arbeid med tema i doks](how-to-work-on-the-docs-theme.md) <ide> - **Valgfrie veiledninger** <del> - [Fang utgående e-poster lokalt](/how-to-catch-outgoing-emails-locally.md) <del> - [Sett opp freeCodeCamp på WSL](/how-to-setup-wsl.md) <add> - [Fang utgående e-poster lokalt](how-to-catch-outgoing-emails-locally.md) <add> - [Sett opp freeCodeCamp på WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **lyse manualer** (for de ansatte & mods) <del> - [Moderator håndbok](/flight-manuals/moderator-handbook.md) <del> - [Svar maler](/flight-manuals/using-reply-templates.md) <del> - [Oversikt over utviklerne](/devops.md) <del> - [Arbeider med servere](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator håndbok](flight-manuals/moderator-handbook.md) <add> - [Svar maler](flight-manuals/using-reply-templates.md) <add> - [Oversikt over utviklerne](devops.md) <add> - [Arbeider med servere](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Polish/_sidebar.md <ide> - **Rozpoczęcie** <del> - [Wprowadzanie](/index.md "Przyczyń się do społeczności FreCodeCamp.org.") <del> - [Często zadawane pytania](/FAQ.md) <add> - [Wprowadzanie](index 'Przyczyń się do społeczności FreCodeCamp.org.') <add> - [Często zadawane pytania](FAQ.md) <ide> - **Kod wpłaty** <del>- - [Skonfiguruj Free CodeCamp lokalnie](/how-to-setup-freecodecamp-locally.md) <del> - [Otwórz Pull Request](/how-to-open-a-pull-request.md) <del> - [Prace nad wyzwaniami w zakresie kodowania](/how-to-work-on-coding-challenges.md) <del> - [Prace nad wyzwaniami wideo](/how-to-help-with-video-challenges.md) <del> - [Prace nad tematem wiadomości](/how-to-work-on-the-news-theme.md) <del> - [Prace nad motywem dokumentów](/how-to-work-on-the-docs-theme.md) <add>- - [Skonfiguruj Free CodeCamp lokalnie](how-to-setup-freecodecamp-locally.md) <add> - [Otwórz Pull Request](how-to-open-a-pull-request.md) <add> - [Prace nad wyzwaniami w zakresie kodowania](how-to-work-on-coding-challenges.md) <add> - [Prace nad wyzwaniami wideo](how-to-help-with-video-challenges.md) <add> - [Prace nad tematem wiadomości](how-to-work-on-the-news-theme.md) <add> - [Prace nad motywem dokumentów](how-to-work-on-the-docs-theme.md) <ide> - **Poradniki opcjonalne** <del> - [Złap wychodzące wiadomości lokalne](/how-to-catch-outgoing-emails-locally.md) <del> - [Skonfiguruj freeCodeCamp na WSL](/how-to-setup-wsl.md) <add> - [Złap wychodzące wiadomości lokalne](how-to-catch-outgoing-emails-locally.md) <add> - [Skonfiguruj freeCodeCamp na WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Instrukcje lotu** (dla personelu & Mody) <del> - [Podręcznik moderatora](/flight-manuals/moderator-handbook.md) <del> - [Szablony odpowiedzi](/flight-manuals/using-reply-templates.md) <del> - [Omówienie DevOps](/devops.md) <del> - [Praca nad serwerami](/flight-manuals/working-on-virtual-machines.md) <add> - [Podręcznik moderatora](flight-manuals/moderator-handbook.md) <add> - [Szablony odpowiedzi](flight-manuals/using-reply-templates.md) <add> - [Omówienie DevOps](devops.md) <add> - [Praca nad serwerami](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Portuguese/_sidebar.md <ide> - **Primeiros passos** <del> - [Introdução](/index.md "Contribua para a comunidade freeCodeCamp.org") <del> - [Perguntas Frequentes](/FAQ.md) <add> - [Introdução](index 'Contribua para a comunidade freeCodeCamp.org') <add> - [Perguntas Frequentes](FAQ.md) <ide> - **Contribuição de código** <del>- - [Configurar freeCodeCamp localmente](/how-to-setup-freecodecamp-locally.md) <del> - [Abrir um pull request](/how-to-open-a-pull-request.md) <del> - [Trabalhe em desafios de programação](/how-to-work-on-coding-challenges.md) <del> - [Trabalho em desafios de vídeo](/how-to-help-with-video-challenges.md) <del> - [Trabalhe no tema de notícias](/how-to-work-on-the-news-theme.md) <del> - [Trabalhe no tema de docs](/how-to-work-on-the-docs-theme.md) <add>- - [Configurar freeCodeCamp localmente](how-to-setup-freecodecamp-locally.md) <add> - [Abrir um pull request](how-to-open-a-pull-request.md) <add> - [Trabalhe em desafios de programação](how-to-work-on-coding-challenges.md) <add> - [Trabalho em desafios de vídeo](how-to-help-with-video-challenges.md) <add> - [Trabalhe no tema de notícias](how-to-work-on-the-news-theme.md) <add> - [Trabalhe no tema de docs](how-to-work-on-the-docs-theme.md) <ide> - **Guias opcionais** <del> - [Captura de e-mails enviados localmente](/how-to-catch-outgoing-emails-locally.md) <del> - [Configurar Campo Livre na WSL](/how-to-setup-wsl.md) <add> - [Captura de e-mails enviados localmente](how-to-catch-outgoing-emails-locally.md) <add> - [Configurar Campo Livre na WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Manuais de Voo** (para equipe & Mods) <del> - [Manual do Moderador](/flight-manuals/moderator-handbook.md) <del> - [Modelos De Resposta](/flight-manuals/using-reply-templates.md) <del> - [Visão Geral DevOps](/devops.md) <del> - [Trabalhando em servidores](/flight-manuals/working-on-virtual-machines.md) <add> - [Manual do Moderador](flight-manuals/moderator-handbook.md) <add> - [Modelos De Resposta](flight-manuals/using-reply-templates.md) <add> - [Visão Geral DevOps](devops.md) <add> - [Trabalhando em servidores](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Romanian/_sidebar.md <ide> - **Noțiuni de bază** <del> - [Introducere](/index.md "Contribuie la comunitatea freeCodeCamp.org") <del> - [Întrebări frecvente](/FAQ.md) <add> - [Introducere](index 'Contribuie la comunitatea freeCodeCamp.org') <add> - [Întrebări frecvente](FAQ.md) <ide> - **Codare Contribuție** <del>- - [Configurează tabăra freeCodep locală](/how-to-setup-freecodecamp-locally.md) <del> - [Deschide o cerere de tragere](/how-to-open-a-pull-request.md) <del> - [Lucrările privind provocările programării](/how-to-work-on-coding-challenges.md) <del> - [Activități privind provocările video](/how-to-help-with-video-challenges.md) <del> - [Lucru la tema știrilor](/how-to-work-on-the-news-theme.md) <del> - [Lucrați la tema docs](/how-to-work-on-the-docs-theme.md) <add>- - [Configurează tabăra freeCodep locală](how-to-setup-freecodecamp-locally.md) <add> - [Deschide o cerere de tragere](how-to-open-a-pull-request.md) <add> - [Lucrările privind provocările programării](how-to-work-on-coding-challenges.md) <add> - [Activități privind provocările video](how-to-help-with-video-challenges.md) <add> - [Lucru la tema știrilor](how-to-work-on-the-news-theme.md) <add> - [Lucrați la tema docs](how-to-work-on-the-docs-theme.md) <ide> - **Ghiduri opționale** <del> - [Prinde e-mailuri trimise local](/how-to-catch-outgoing-emails-locally.md) <del> - [Configurați tabăra freeCodep pe WSL](/how-to-setup-wsl.md) <add> - [Prinde e-mailuri trimise local](how-to-catch-outgoing-emails-locally.md) <add> - [Configurați tabăra freeCodep pe WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Manuale de zbor** (pentru personal & Mods) <del> - [Manual Moderator](/flight-manuals/moderator-handbook.md) <del> - [Şabloane de răspuns](/flight-manuals/using-reply-templates.md) <del> - [Sumar DevOps](/devops.md) <del> - [Lucru pe Servere](/flight-manuals/working-on-virtual-machines.md) <add> - [Manual Moderator](flight-manuals/moderator-handbook.md) <add> - [Şabloane de răspuns](flight-manuals/using-reply-templates.md) <add> - [Sumar DevOps](devops.md) <add> - [Lucru pe Servere](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Russian/_sidebar.md <ide> - **Начало работы** <del> - [Введение](/index.md "Помочь сообществу freeCodeCamp.org") <del> - [Часто задаваемые вопросы](/FAQ.md) <add> - [Введение](index 'Помочь сообществу freeCodeCamp.org') <add> - [Часто задаваемые вопросы](FAQ.md) <ide> - **Вклад кода** <del>- - [Настроить freeCodeCamp локально](/how-to-setup-freecodecamp-locally.md) <del> - [Открыть pull-request](/how-to-open-a-pull-request.md) <del> - [Работа над задачами кодирования](/how-to-work-on-coding-challenges.md) <del> - [Работа над видео задачами](/how-to-help-with-video-challenges.md) <del> - [Работа над новостной темой](/how-to-work-on-the-news-theme.md) <del> - [Работа над темой документации](/how-to-work-on-the-docs-theme.md) <add>- - [Настроить freeCodeCamp локально](how-to-setup-freecodecamp-locally.md) <add> - [Открыть pull-request](how-to-open-a-pull-request.md) <add> - [Работа над задачами кодирования](how-to-work-on-coding-challenges.md) <add> - [Работа над видео задачами](how-to-help-with-video-challenges.md) <add> - [Работа над новостной темой](how-to-work-on-the-news-theme.md) <add> - [Работа над темой документации](how-to-work-on-the-docs-theme.md) <ide> - **Необязательные руководства** <del> - [Поймать исходящие письма локально](/how-to-catch-outgoing-emails-locally.md) <del> - [Настроить freeCodeCamp на WSL](/how-to-setup-wsl.md) <add> - [Поймать исходящие письма локально](how-to-catch-outgoing-emails-locally.md) <add> - [Настроить freeCodeCamp на WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Руководства по полю** (для персонала & мод) <del> - [Руководство модератора](/flight-manuals/moderator-handbook.md) <del> - [Шаблоны ответов](/flight-manuals/using-reply-templates.md) <del> - [Обзор Дьявола](/devops.md) <del> - [Работа на серверах](/flight-manuals/working-on-virtual-machines.md) <add> - [Руководство модератора](flight-manuals/moderator-handbook.md) <add> - [Шаблоны ответов](flight-manuals/using-reply-templates.md) <add> - [Обзор Дьявола](devops.md) <add> - [Работа на серверах](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Serbian/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Spanish/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Swedish/_sidebar.md <ide> - **Kom igång** <del> - [Introduktion](/index.md "Bidra till freeCodeCamp.org-gemenskapen") <del> - [Vanliga frågor](/FAQ.md) <add> - [Introduktion](index 'Bidra till freeCodeCamp.org-gemenskapen') <add> - [Vanliga frågor](FAQ.md) <ide> - **Kodbidrag** <del>- - [Ställ in freeCodeCamp lokalt](/how-to-setup-freecodecamp-locally.md) <del> - [Öppna en pull-förfrågan](/how-to-open-a-pull-request.md) <del> - [Arbeta med kodningsutmaningar](/how-to-work-on-coding-challenges.md) <del> - [Arbeta på videoutmaningar](/how-to-help-with-video-challenges.md) <del> - [Arbeta på nyhetstemat](/how-to-work-on-the-news-theme.md) <del> - [Arbeta på docs tema](/how-to-work-on-the-docs-theme.md) <add>- - [Ställ in freeCodeCamp lokalt](how-to-setup-freecodecamp-locally.md) <add> - [Öppna en pull-förfrågan](how-to-open-a-pull-request.md) <add> - [Arbeta med kodningsutmaningar](how-to-work-on-coding-challenges.md) <add> - [Arbeta på videoutmaningar](how-to-help-with-video-challenges.md) <add> - [Arbeta på nyhetstemat](how-to-work-on-the-news-theme.md) <add> - [Arbeta på docs tema](how-to-work-on-the-docs-theme.md) <ide> - **Valfria guider** <del> - [Fånga utgående e-postmeddelanden lokalt](/how-to-catch-outgoing-emails-locally.md) <del> - [Ställ in freeCodeCamp på WSL](/how-to-setup-wsl.md) <add> - [Fånga utgående e-postmeddelanden lokalt](how-to-catch-outgoing-emails-locally.md) <add> - [Ställ in freeCodeCamp på WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flyghandböcker** (för personal & moduler) <del> - [Moderator Handbok](/flight-manuals/moderator-handbook.md) <del> - [Svara mallar](/flight-manuals/using-reply-templates.md) <del> - [DevOps översikt](/devops.md) <del> - [Arbetar på servrar](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbok](flight-manuals/moderator-handbook.md) <add> - [Svara mallar](flight-manuals/using-reply-templates.md) <add> - [DevOps översikt](devops.md) <add> - [Arbetar på servrar](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Turkish/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Ukrainian/_sidebar.md <ide> - **З чого почати** <del> - [Вступ](/index.md "Сприяти безкоштовному CodeCamp.org спільноті") <del> - [Найчастіші питання](/FAQ.md) <add> - [Вступ](index 'Сприяти безкоштовному CodeCamp.org спільноті') <add> - [Найчастіші питання](FAQ.md) <ide> - **Внесок коду** <del>- - [Встановити вільний CodeCamp локально](/how-to-setup-freecodecamp-locally.md) <del> - [Відкрити запит на злиття](/how-to-open-a-pull-request.md) <del> - [Робота над завданнями з кодуванням](/how-to-work-on-coding-challenges.md) <del> - [Робота з відео викликами](/how-to-help-with-video-challenges.md) <del> - [Робота з темою новин](/how-to-work-on-the-news-theme.md) <del> - [Працювати в документації](/how-to-work-on-the-docs-theme.md) <add>- - [Встановити вільний CodeCamp локально](how-to-setup-freecodecamp-locally.md) <add> - [Відкрити запит на злиття](how-to-open-a-pull-request.md) <add> - [Робота над завданнями з кодуванням](how-to-work-on-coding-challenges.md) <add> - [Робота з відео викликами](how-to-help-with-video-challenges.md) <add> - [Робота з темою новин](how-to-work-on-the-news-theme.md) <add> - [Працювати в документації](how-to-work-on-the-docs-theme.md) <ide> - **Необов'язкові посібники** <del> - [Спіймати вихідні листи локально](/how-to-catch-outgoing-emails-locally.md) <del> - [Встановити безкоштовний CodeCamp на WSL](/how-to-setup-wsl.md) <add> - [Спіймати вихідні листи локально](how-to-catch-outgoing-emails-locally.md) <add> - [Встановити безкоштовний CodeCamp на WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Політ** (для співробітників & модифікації) <del> - [Довідник модератора](/flight-manuals/moderator-handbook.md) <del> - [Шаблони для відповідей](/flight-manuals/using-reply-templates.md) <del> - [Огляд DevOps](/devops.md) <del> - [Робота на серверах](/flight-manuals/working-on-virtual-machines.md) <add> - [Довідник модератора](flight-manuals/moderator-handbook.md) <add> - [Шаблони для відповідей](flight-manuals/using-reply-templates.md) <add> - [Огляд DevOps](devops.md) <add> - [Робота на серверах](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <ide><path>docs/i18n/Vietnamese/_sidebar.md <ide> - **Getting Started** <del> - [Introduction](/index.md "Contribute to the freeCodeCamp.org Community") <del> - [Frequently Asked Questions](/FAQ.md) <add> - [Introduction](index 'Contribute to the freeCodeCamp.org Community') <add> - [Frequently Asked Questions](FAQ.md) <ide> - **Code Contribution** <del>- - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <del> - [Open a pull request](/how-to-open-a-pull-request.md) <del> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <del> - [Work on video challenges](/how-to-help-with-video-challenges.md) <del> - [Work on the news theme](/how-to-work-on-the-news-theme.md) <del> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <add>- - [Set up freeCodeCamp locally](how-to-setup-freecodecamp-locally.md) <add> - [Open a pull request](how-to-open-a-pull-request.md) <add> - [Work on coding challenges](how-to-work-on-coding-challenges.md) <add> - [Work on video challenges](how-to-help-with-video-challenges.md) <add> - [Work on the news theme](how-to-work-on-the-news-theme.md) <add> - [Work on the docs theme](how-to-work-on-the-docs-theme.md) <ide> - **Optional Guides** <del> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <del> - [Set up freeCodeCamp on WSL](/how-to-setup-wsl.md) <add> - [Catch outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <add> - [Set up freeCodeCamp on WSL](how-to-setup-wsl.md) <ide> <ide> --- <ide> <ide> - **中文社区贡献指南** <del> - [成为专栏作者](/i18n/chinese/news-author-application.md) <del> - [文章翻译计划](/i18n/chinese/news-translations.md) <del> - [视频翻译计划](/i18n/chinese/video-translations.md) <add> - [成为专栏作者](i18n/chinese/news-author-application.md) <add> - [文章翻译计划](i18n/chinese/news-translations.md) <add> - [视频翻译计划](i18n/chinese/video-translations.md) <ide> <ide> --- <ide> <ide> - **Flight Manuals** (for Staff & Mods) <del> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <del> - [Reply Templates](/flight-manuals/using-reply-templates.md) <del> - [DevOps Overview](/devops.md) <del> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <add> - [Moderator Handbook](flight-manuals/moderator-handbook.md) <add> - [Reply Templates](flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](devops.md) <add> - [Working on Servers](flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide>
29
PHP
PHP
use locatorawaretrait in controller and cell
872df7a42ab86b70b710b875e7d2a7af93bb19c7
<ide><path>src/Controller/Controller.php <ide> use Cake\Log\LogTrait; <ide> use Cake\Network\Request; <ide> use Cake\Network\Response; <add>use Cake\ORM\Locator\LocatorAwareTrait; <ide> use Cake\Routing\RequestActionTrait; <ide> use Cake\Routing\Router; <ide> use Cake\Utility\MergeVariablesTrait; <ide> class Controller implements EventListenerInterface <ide> { <ide> <ide> use EventManagerTrait; <add> use LocatorAwareTrait; <ide> use LogTrait; <ide> use MergeVariablesTrait; <ide> use ModelAwareTrait; <ide> public function __construct(Request $request = null, Response $response = null, <ide> $this->eventManager($eventManager); <ide> } <ide> <del> $this->modelFactory('Table', ['Cake\ORM\TableRegistry', 'get']); <add> $this->modelFactory('Table', [$this->locator(), 'get']); <ide> $modelClass = ($this->plugin ? $this->plugin . '.' : '') . $this->name; <ide> $this->_setModelClass($modelClass); <ide> <ide><path>src/View/Cell.php <ide> use Cake\Event\EventManagerTrait; <ide> use Cake\Network\Request; <ide> use Cake\Network\Response; <add>use Cake\ORM\Locator\LocatorAwareTrait; <ide> use Cake\Utility\Inflector; <ide> use Cake\View\Exception\MissingCellViewException; <ide> use Cake\View\Exception\MissingTemplateException; <ide> abstract class Cell <ide> { <ide> <ide> use EventManagerTrait; <add> use LocatorAwareTrait; <ide> use ModelAwareTrait; <ide> use ViewVarsTrait; <ide> <ide> public function __construct( <ide> $this->eventManager($eventManager); <ide> $this->request = $request; <ide> $this->response = $response; <del> $this->modelFactory('Table', ['Cake\ORM\TableRegistry', 'get']); <add> $this->modelFactory('Table', [$this->locator(), 'get']); <ide> <ide> foreach ($this->_validCellOptions as $var) { <ide> if (isset($cellOptions[$var])) {
2
PHP
PHP
allow false guard
55f3b1542751df86610d4d3be88e3fc77e4709cc
<ide><path>src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php <ide> public function mergeFillable(array $fillable) <ide> */ <ide> public function getGuarded() <ide> { <del> return $this->guarded; <add> return $this->guarded === false <add> ? [] <add> : $this->guarded; <ide> } <ide> <ide> /**
1
Ruby
Ruby
remove exception variable from rescue block
a03ab8cef8c712cad3dafd06c1b483782a1c0eb5
<ide><path>activemodel/lib/active_model/secure_password.rb <ide> def has_secure_password(options = {}) <ide> begin <ide> gem 'bcrypt-ruby', '~> 3.0.0' <ide> require 'bcrypt' <del> rescue LoadError => e <add> rescue LoadError <ide> $stderr.puts "You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install" <del> raise e <add> raise <ide> end <ide> <ide> attr_reader :password
1
Text
Text
add v3.8.0-beta.5 to changelog
86b9f705c72de7ea2ad139c66f2977e82e95a898
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.8.0-beta.5 (February 11, 2019) <add> <add>- [#17563](https://github.com/emberjs/ember.js/pull/17563) [BUGFIX] Transition.send/trigger call signature <add> <ide> ### v3.8.0-beta.4 (February 4, 2019) <ide> <ide> - [#17552](https://github.com/emberjs/ember.js/pull/17552) [BUGFIX] Support numbers in component names for Angle Brackets
1
Python
Python
remove the unused get_io_counters calls
1e0a303efb7c6c4aa64f6cfbabf8e80813dbf781
<ide><path>src/glances.py <ide> #===== <ide> <ide> application = 'glances' <del>__version__ = "1.4b" <add>__version__ = "1.4b2" <ide> gettext.install(application) <ide> <ide> try: <ide> def __update__(self): <ide> procstat['proc_size'] = proc.get_memory_info().vms <ide> procstat['proc_resident'] = proc.get_memory_info().rss <ide> procstat['cpu_percent'] = proc._before.get_cpu_percent(interval=0) <del> procstat['diskio_read'] = proc.get_io_counters().read_bytes - proc._before.get_io_counters().read_bytes <del> procstat['diskio_write'] = proc.get_io_counters().write_bytes - proc._before.get_io_counters().write_bytes <add> #~ procstat['diskio_read'] = proc.get_io_counters().read_bytes - proc._before.get_io_counters().read_bytes <add> #~ procstat['diskio_write'] = proc.get_io_counters().write_bytes - proc._before.get_io_counters().write_bytes <ide> self.process.append(procstat) <ide> except: <ide> pass
1
Mixed
Javascript
support uint8array input to methods
9f610b5e265549f048ef00cf521a0d36771c9574
<ide><path>doc/api/stream.md <ide> There are four fundamental stream types within Node.js: <ide> ### Object Mode <ide> <ide> All streams created by Node.js APIs operate exclusively on strings and `Buffer` <del>objects. It is possible, however, for stream implementations to work with other <del>types of JavaScript values (with the exception of `null`, which serves a special <del>purpose within streams). Such streams are considered to operate in "object <del>mode". <add>(or `Uint8Array`) objects. It is possible, however, for stream implementations <add>to work with other types of JavaScript values (with the exception of `null`, <add>which serves a special purpose within streams). Such streams are considered to <add>operate in "object mode". <ide> <ide> Stream instances are switched into object mode using the `objectMode` option <ide> when the stream is created. Attempting to switch an existing stream into <ide> See also: [`writable.uncork()`][]. <ide> ##### writable.end([chunk][, encoding][, callback]) <ide> <!-- YAML <ide> added: v0.9.4 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/11608 <add> description: The `chunk` argument can now be a `Uint8Array` instance. <ide> --> <ide> <del>* `chunk` {string|Buffer|any} Optional data to write. For streams not operating <del> in object mode, `chunk` must be a string or a `Buffer`. For object mode <del> streams, `chunk` may be any JavaScript value other than `null`. <del>* `encoding` {string} The encoding, if `chunk` is a String <add>* `chunk` {string|Buffer|Uint8Array|any} Optional data to write. For streams <add> not operating in object mode, `chunk` must be a string, `Buffer` or <add> `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value <add> other than `null`. <add>* `encoding` {string} The encoding, if `chunk` is a string <ide> * `callback` {Function} Optional callback for when the stream is finished <ide> <ide> Calling the `writable.end()` method signals that no more data will be written <ide> See also: [`writable.cork()`][]. <ide> <!-- YAML <ide> added: v0.9.4 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/11608 <add> description: The `chunk` argument can now be a `Uint8Array` instance. <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/6170 <ide> description: Passing `null` as the `chunk` parameter will always be <ide> considered invalid now, even in object mode. <ide> --> <ide> <del>* `chunk` {string|Buffer} The data to write <del>* `encoding` {string} The encoding, if `chunk` is a String <add>* `chunk` {string|Buffer|Uint8Array|any} Optional data to write. For streams <add> not operating in object mode, `chunk` must be a string, `Buffer` or <add> `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value <add> other than `null`. <add>* `encoding` {string} The encoding, if `chunk` is a string <ide> * `callback` {Function} Callback for when this chunk of data is flushed <ide> * Returns: {boolean} `false` if the stream wishes for the calling code to <ide> wait for the `'drain'` event to be emitted before continuing to write <ide> setTimeout(() => { <ide> ##### readable.unshift(chunk) <ide> <!-- YAML <ide> added: v0.9.11 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/11608 <add> description: The `chunk` argument can now be a `Uint8Array` instance. <ide> --> <ide> <del>* `chunk` {Buffer|string|any} Chunk of data to unshift onto the read queue <add>* `chunk` {Buffer|Uint8Array|string|any} Chunk of data to unshift onto the <add> read queue. For streams not operating in object mode, `chunk` must be a <add> string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be <add> any JavaScript value other than `null`. <ide> <ide> The `readable.unshift()` method pushes a chunk of data back into the internal <ide> buffer. This is useful in certain situations where a stream is being consumed by <ide> constructor and implement the `writable._write()` method. The <ide> Defaults to `true` <ide> * `objectMode` {boolean} Whether or not the <ide> [`stream.write(anyObj)`][stream-write] is a valid operation. When set, <del> it becomes possible to write JavaScript values other than string or <del> `Buffer` if supported by the stream implementation. Defaults to `false` <add> it becomes possible to write JavaScript values other than string, <add> `Buffer` or `Uint8Array` if supported by the stream implementation. <add> Defaults to `false` <ide> * `write` {Function} Implementation for the <ide> [`stream._write()`][stream-_write] method. <ide> * `writev` {Function} Implementation for the <ide> internal to the class that defines it, and should never be called directly by <ide> user programs. <ide> <ide> #### readable.push(chunk[, encoding]) <add><!-- YAML <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/11608 <add> description: The `chunk` argument can now be a `Uint8Array` instance. <add>--> <ide> <del>* `chunk` {Buffer|null|string|any} Chunk of data to push into the read queue <del>* `encoding` {string} Encoding of String chunks. Must be a valid <add>* `chunk` {Buffer|Uint8Array|string|null|any} Chunk of data to push into the <add> read queue. For streams not operating in object mode, `chunk` must be a <add> string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be <add> any JavaScript value. <add>* `encoding` {string} Encoding of string chunks. Must be a valid <ide> Buffer encoding, such as `'utf8'` or `'ascii'` <ide> * Returns {boolean} `true` if additional chunks of data may continued to be <ide> pushed; `false` otherwise. <ide> <del>When `chunk` is not `null`, the `chunk` of data will be added to the <del>internal queue for users of the stream to consume. Passing `chunk` as `null` <del>signals the end of the stream (EOF), after which no more data can be written. <add>When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will <add>be added to the internal queue for users of the stream to consume. <add>Passing `chunk` as `null` signals the end of the stream (EOF), after which no <add>more data can be written. <ide> <ide> When the Readable is operating in paused mode, the data added with <ide> `readable.push()` can be read out by calling the <ide> Readable stream class internals. <ide> <ide> Use of `readable.push('')` is not recommended. <ide> <del>Pushing a zero-byte string or `Buffer` to a stream that is not in object mode <del>has an interesting side effect. Because it *is* a call to <add>Pushing a zero-byte string, `Buffer` or `Uint8Array` to a stream that is not in <add>object mode has an interesting side effect. Because it *is* a call to <ide> [`readable.push()`][stream-push], the call will end the reading process. <ide> However, because the argument is an empty string, no data is added to the <ide> readable buffer so there is nothing for a user to consume. <ide><path>lib/_stream_readable.js <ide> function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { <ide> if (er) { <ide> stream.emit('error', er); <ide> } else if (state.objectMode || chunk && chunk.length > 0) { <add> if (typeof chunk !== 'string' && <add> Object.getPrototypeOf(chunk) !== Buffer.prototype && <add> !state.objectMode) { <add> chunk = Stream._uint8ArrayToBuffer(chunk); <add> } <add> <ide> if (addToFront) { <ide> if (state.endEmitted) <ide> stream.emit('error', new Error('stream.unshift() after end event')); <ide> function addChunk(stream, state, chunk, addToFront) { <ide> <ide> function chunkInvalid(state, chunk) { <ide> var er; <del> if (!(chunk instanceof Buffer) && <add> if (!Stream._isUint8Array(chunk) && <ide> typeof chunk !== 'string' && <ide> chunk !== undefined && <ide> !state.objectMode) { <ide><path>lib/_stream_writable.js <ide> function validChunk(stream, state, chunk, cb) { <ide> Writable.prototype.write = function(chunk, encoding, cb) { <ide> var state = this._writableState; <ide> var ret = false; <del> var isBuf = (chunk instanceof Buffer); <add> var isBuf = Stream._isUint8Array(chunk) && !state.objectMode; <add> <add> if (isBuf && Object.getPrototypeOf(chunk) !== Buffer.prototype) { <add> chunk = Stream._uint8ArrayToBuffer(chunk); <add> } <ide> <ide> if (typeof encoding === 'function') { <ide> cb = encoding; <ide><path>lib/internal/streams/BufferList.js <ide> <ide> const Buffer = require('buffer').Buffer; <ide> <add>function copyBuffer(src, target, offset) { <add> Buffer.prototype.copy.call(src, target, offset); <add>} <add> <ide> module.exports = class BufferList { <ide> constructor() { <ide> this.head = null; <ide> module.exports = class BufferList { <ide> var p = this.head; <ide> var i = 0; <ide> while (p) { <del> p.data.copy(ret, i); <add> copyBuffer(p.data, ret, i); <ide> i += p.data.length; <ide> p = p.next; <ide> } <ide><path>lib/stream.js <ide> <ide> 'use strict'; <ide> <add>const Buffer = require('buffer').Buffer; <add> <ide> // Note: export Stream before Readable/Writable/Duplex/... <ide> // to avoid a cross-reference(require) issues <ide> const Stream = module.exports = require('internal/streams/legacy'); <ide> Stream.PassThrough = require('_stream_passthrough'); <ide> <ide> // Backwards-compat with node 0.4.x <ide> Stream.Stream = Stream; <add> <add>// Internal utilities <add>try { <add> Stream._isUint8Array = process.binding('util').isUint8Array; <add>} catch (e) { <add> // This throws for Node < 4.2.0 because there’s no util binding and <add> // returns undefined for Node < 7.4.0. <add>} <add> <add>if (!Stream._isUint8Array) { <add> Stream._isUint8Array = function _isUint8Array(obj) { <add> return Object.prototype.toString.call(obj) === '[object Uint8Array]'; <add> }; <add>} <add> <add>const version = process.version.substr(1).split('.'); <add>if (version[0] === 0 && version[1] < 12) { <add> Stream._uint8ArrayToBuffer = Buffer; <add>} else { <add> try { <add> const internalBuffer = require('internal/buffer'); <add> Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { <add> return new internalBuffer.FastBuffer(chunk.buffer, <add> chunk.byteOffset, <add> chunk.byteLength); <add> }; <add> } catch (e) { <add> } <add> <add> if (!Stream._uint8ArrayToBuffer) { <add> Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { <add> return Buffer.prototype.slice.call(chunk); <add> }; <add> } <add>} <ide><path>test/parallel/test-stream-uint8array.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const Buffer = require('buffer').Buffer; <add> <add>const { Readable, Writable } = require('stream'); <add> <add>const ABC = new Uint8Array([0x41, 0x42, 0x43]); <add>const DEF = new Uint8Array([0x44, 0x45, 0x46]); <add>const GHI = new Uint8Array([0x47, 0x48, 0x49]); <add> <add>{ <add> // Simple Writable test. <add> <add> let n = 0; <add> const writable = new Writable({ <add> write: common.mustCall((chunk, encoding, cb) => { <add> assert(chunk instanceof Buffer); <add> if (n++ === 0) { <add> assert.strictEqual(String(chunk), 'ABC'); <add> } else { <add> assert.strictEqual(String(chunk), 'DEF'); <add> } <add> <add> cb(); <add> }, 2) <add> }); <add> <add> writable.write(ABC); <add> writable.end(DEF); <add>} <add> <add>{ <add> // Writable test, pass in Uint8Array in object mode. <add> <add> const writable = new Writable({ <add> objectMode: true, <add> write: common.mustCall((chunk, encoding, cb) => { <add> assert(!(chunk instanceof Buffer)); <add> assert(chunk instanceof Uint8Array); <add> assert.strictEqual(chunk, ABC); <add> assert.strictEqual(encoding, 'utf8'); <add> cb(); <add> }) <add> }); <add> <add> writable.end(ABC); <add>} <add> <add>{ <add> // Writable test, multiple writes carried out via writev. <add> let callback; <add> <add> const writable = new Writable({ <add> write: common.mustCall((chunk, encoding, cb) => { <add> assert(chunk instanceof Buffer); <add> assert.strictEqual(encoding, 'buffer'); <add> assert.strictEqual(String(chunk), 'ABC'); <add> callback = cb; <add> }), <add> writev: common.mustCall((chunks, cb) => { <add> assert.strictEqual(chunks.length, 2); <add> assert.strictEqual(chunks[0].encoding, 'buffer'); <add> assert.strictEqual(chunks[1].encoding, 'buffer'); <add> assert.strictEqual(chunks[0].chunk + chunks[1].chunk, 'DEFGHI'); <add> }) <add> }); <add> <add> writable.write(ABC); <add> writable.write(DEF); <add> writable.end(GHI); <add> callback(); <add>} <add> <add>{ <add> // Simple Readable test. <add> const readable = new Readable({ <add> read() {} <add> }); <add> <add> readable.push(DEF); <add> readable.unshift(ABC); <add> <add> const buf = readable.read(); <add> assert(buf instanceof Buffer); <add> assert.deepStrictEqual([...buf], [...ABC, ...DEF]); <add>} <add> <add>{ <add> // Readable test, setEncoding. <add> const readable = new Readable({ <add> read() {} <add> }); <add> <add> readable.setEncoding('utf8'); <add> <add> readable.push(DEF); <add> readable.unshift(ABC); <add> <add> const out = readable.read(); <add> assert.strictEqual(out, 'ABCDEF'); <add>}
6
Javascript
Javascript
handle css urls better
2a8973489f88b80a42988ed9801de9e16126aa6b
<ide><path>threejs/resources/editor.js <ide> function getPrefix(url) { <ide> } <ide> <ide> function fixCSSLinks(url, source) { <del> const cssUrlRE = /(url\()(.*?)(\))/g; <add> const cssUrlRE1 = /(url\(')(.*?)('\))/g; <add> const cssUrlRE2 = /(url\()(.*?)(\))/g; <ide> const prefix = getPrefix(url); <ide> <ide> function addPrefix(url) { <del> return url.indexOf('://') < 0 ? (prefix + url) : url; <add> return url.indexOf('://') < 0 ? `${prefix}/${url}` : url; <ide> } <ide> function makeFQ(match, prefix, url, suffix) { <ide> return `${prefix}${addPrefix(url)}${suffix}`; <ide> } <ide> <del> source = source.replace(cssUrlRE, makeFQ); <add> source = source.replace(cssUrlRE1, makeFQ); <add> source = source.replace(cssUrlRE2, makeFQ); <ide> return source; <ide> } <ide>
1
PHP
PHP
add replace method
d138e4cc950edc2685750dbfa22b4f01bc6b25e1
<ide><path>src/Illuminate/Support/Stringable.php <ide> public function prepend(...$values) <ide> return new static(implode('', $values).$this->value); <ide> } <ide> <add> /** <add> * Replace the given value in the given string. <add> * <add> * @param string $search <add> * @param string $replace <add> * @return static <add> */ <add> public function replace($search, $replace) <add> { <add> return new static(str_replace($search, $replace, $this->value)); <add> } <add> <ide> /** <ide> * Replace a given value in the string sequentially with an array. <ide> *
1
Python
Python
remove unused imports
c67937bebbb8b1de01e8fb878608b8ea5a34cba3
<ide><path>tools/gyp_node.py <ide> #!/usr/bin/env python <del>import glob <ide> import os <del>import shlex <ide> import sys <ide> <ide> script_dir = os.path.dirname(__file__) <ide><path>tools/install.py <ide> import os <ide> import re <ide> import shutil <del>import stat <ide> import sys <ide> <ide> # set at init time
2
PHP
PHP
add php doc to facade
2b30f092f0732cfb9e127fa4c1382ea170fb9cad
<ide><path>src/Illuminate/Support/Facades/Schema.php <ide> * @method static \Illuminate\Database\Schema\Builder drop(string $table) <ide> * @method static \Illuminate\Database\Schema\Builder dropIfExists(string $table) <ide> * @method static \Illuminate\Database\Schema\Builder table(string $table, \Closure $callback) <add> * @method static void defaultStringLength(int $length) <ide> * <ide> * @see \Illuminate\Database\Schema\Builder <ide> */
1
Python
Python
update example file for lxd
7edf36e6c94413f32d3fd6415f1a29ec661fd0be
<ide><path>example_lxd.py <ide> def pylxdFunc(): <ide> <ide> <ide> def work_with_containers(): <add> print("Working with containers...") <ide> <ide> # LXD API specification can be found at: <ide> # https://github.com/lxc/lxd/blob/master/doc/rest-api.md#10containersnamemetadata <ide> def work_with_containers(): <ide> containers = conn.list_containers() <ide> <ide> if len(containers) == 0: <del> print("No containers have been created") <add> print("\tNo containers have been created") <ide> else: <del> print("Number of containers: %s" % len(containers)) <add> print("\tNumber of containers: %s" % len(containers)) <ide> for container in containers: <del> print("Container: %s is: %s" % (container.name, container.state)) <del> <add> print("\t\tContainer: %s is: %s" % (container.name, container.state)) <ide> <ide> # start the first container <del> print("Starting container: %s" % containers[0].name) <add> print("\tStarting container: %s" % containers[0].name) <ide> container = conn.start_container(container=containers[0]) <del> print("Container: %s is: %s" % (container.name, container.state)) <add> print("\tContainer: %s is: %s" % (container.name, container.state)) <ide> <ide> # stop the container returned <del> print("Stopping container: %s" % containers[0].name) <add> print("\tStopping container: %s" % containers[0].name) <ide> container = conn.stop_container(container=container) <del> print("Container: %s is: %s" % (container.name, container.state)) <add> print("\tContainer: %s is: %s" % (container.name, container.state)) <ide> <ide> # restart the container <del> print("Restarting container: %s" % container.name) <add> print("\tRestarting container: %s" % container.name) <ide> container = conn.restart_container(container=container) <del> print("Container: %s is: %s" % (container.name, container.state)) <add> print("\tContainer: %s is: %s" % (container.name, container.state)) <ide> <ide> if len(containers) == 2: <ide> <ide> # delete the second container <del> print("Deleting container: %s" % containers[1].name) <add> print("\tDeleting container: %s" % containers[1].name) <ide> response = conn.destroy_container(container=containers[1]) <del> print("Response from attempting to delete container %s " % (containers[1].name), " ", response) <add> print("\tResponse from attempting to delete container %s " % (containers[1].name), " ", response) <ide> <ide> # get the list of the containers <ide> containers = conn.list_containers() <ide> def work_with_containers(): <ide> <ide> if name not in [container.name for container in containers]: <ide> <del> print("Creating container: %s" % name) <add> print("\tCreating container: %s" % name) <ide> <ide> try: <ide> image = conn.get_img_by_name(img_name='ubuntu-xenial') <ide> def work_with_containers(): <ide> <ide> parameters = {'public': False, "ephemeral": False, "architecture": "x86_64", "config": {"limits.cpu": "2"},} <ide> container = conn.deploy_container(name=name, image=image, parameters=parameters) <del> print("Response from attempting to create container: ", container) <add> print("\tResponse from attempting to create container: ", container) <ide> <ide> # get the list of the containers <ide> containers = conn.list_containers() <ide> <ide> if len(containers) == 0: <del> print("No containers have been created") <add> print("\tNo containers have been created") <ide> else: <del> print("Number of containers: %s" % len(containers)) <add> print("\tNumber of containers: %s" % len(containers)) <ide> for container in containers: <del> print("Container: %s is: %s" % (container.name, container.state)) <add> print("\t\tContainer: %s is: %s" % (container.name, container.state)) <ide> <ide> def work_with_images(): <add> <add> print("Working with images...") <add> <ide> # LXD host change accordingly <ide> host_lxd = 'https://192.168.2.4' <ide> <ide> def work_with_images(): <ide> print("\tPath ", image.path) <ide> print("\tVersion ", image.version) <ide> <add> <add> conn.create_image() <add> <ide> def work_with_storage_pools(): <del> pass <add> print("Working with storage pools...") <add> <add> # LXD host change accordingly <add> host_lxd = 'https://192.168.2.4' <add> <add> # port that LXD server is listening at <add> # change this according to your configuration <add> port_id = 8443 <add> <add> # get the libcloud LXD driver <add> lxd_driver = get_driver(Provider.LXD) <add> <add> # acquire the connection. <add> # certificates should have been added to the LXD server <add> # here we assume they are on the same directory change <add> # accordingly <add> conn = lxd_driver(key='', secret='', secure=False, <add> host=host_lxd, port=port_id, key_file='lxd.key', cert_file='lxd.crt') <add> <add> # get the images this LXD server is publishing <add> pools = conn.list_storage_pools() <add> <add> print("Number of storage pools: ", len(pools)) <add> <add> for pool in pools: <add> print("\tPool: ",pool.name) <add> print("\t\tDriver: ", pool.driver) <add> print("\t\tUsed by: ", pool.used_by) <add> print("\t\tConfig: ", pool.config) <ide> <ide> <ide> if __name__ == '__main__': <ide> <del> work_with_containers() <add> #work_with_containers() <ide> work_with_images() <ide> work_with_storage_pools() <ide>\ No newline at end of file
1
Python
Python
fix incorrect printing of 1d masked arrays
d805e9b66228e68a0eb14d901cd350159c49af18
<ide><path>numpy/ma/core.py <ide> class MaskedArray(ndarray): <ide> _defaultmask = nomask <ide> _defaulthardmask = False <ide> _baseclass = ndarray <del> # Maximum number of elements per axis used when printing an array. <add> <add> # Maximum number of elements per axis used when printing an array. The <add> # 1d case is handled separately because we need more values in this case. <ide> _print_width = 100 <add> _print_width_1d = 1500 <ide> <ide> def __new__(cls, data=None, mask=nomask, dtype=None, copy=False, <ide> subok=True, ndmin=0, fill_value=None, keep_mask=True, <ide> def __str__(self): <ide> mask = m <ide> # For big arrays, to avoid a costly conversion to the <ide> # object dtype, extract the corners before the conversion. <add> print_width = (self._print_width if self.ndim > 1 <add> else self._print_width_1d) <ide> for axis in range(self.ndim): <del> if data.shape[axis] > self._print_width: <del> ind = self._print_width // 2 <add> if data.shape[axis] > print_width: <add> ind = print_width // 2 <ide> arr = np.split(data, (ind, -ind), axis=axis) <ide> data = np.concatenate((arr[0], arr[2]), axis=axis) <ide> arr = np.split(mask, (ind, -ind), axis=axis) <ide><path>numpy/ma/tests/test_core.py <ide> def test_str_repr(self): <ide> ' mask = [False True False],\n' <ide> ' fill_value = 999999)\n') <ide> <add> a = np.ma.arange(2000) <add> a[1:50] = np.ma.masked <add> assert_equal( <add> repr(a), <add> 'masked_array(data = [0 -- -- ..., 1997 1998 1999],\n' <add> ' mask = [False True True ..., False False False],\n' <add> ' fill_value = 999999)\n' <add> ) <add> <ide> def test_pickling(self): <ide> # Tests pickling <ide> a = arange(10)
2
PHP
PHP
add hmac to encrypted data
95ad5f5c78f8bff40924eb0803cdc62e3070bb3d
<ide><path>lib/Cake/Test/Case/Utility/SecurityTest.php <ide> public function testEncryptDecrypt() { <ide> $this->assertEquals($txt, Security::decrypt($result, $key)); <ide> } <ide> <add>/** <add> * Test that changing the key causes decryption to fail. <add> * <add> * @return void <add> */ <add> public function testDecryptKeyFailure() { <add> $txt = 'The quick brown fox'; <add> $key = 'This key is longer than 32 bytes long.'; <add> $result = Security::encrypt($txt, $key); <add> <add> $key = 'Not the same key. This one will fail'; <add> $this->assertFalse(Security::decrypt($txt, $key), 'Modified key will fail.'); <add> } <add> <add>/** <add> * Test that decrypt fails when there is an hmac error. <add> * <add> * @return void <add> */ <add> public function testDecryptHmacFailure() { <add> $txt = 'The quick brown fox'; <add> $key = 'This key is quite long and works well.'; <add> $salt = 'this is a delicious salt!'; <add> $result = Security::encrypt($txt, $key, $salt); <add> <add> // Change one of the bytes in the hmac. <add> $result[10] = 'x'; <add> $this->assertFalse(Security::decrypt($result, $key, $salt), 'Modified hmac causes failure.'); <add> } <add> <add>/** <add> * Test that changing the hmac salt will cause failures. <add> * <add> * @return void <add> */ <add> public function testDecryptHmacSaltFailure() { <add> $txt = 'The quick brown fox'; <add> $key = 'This key is quite long and works well.'; <add> $salt = 'this is a delicious salt!'; <add> $result = Security::encrypt($txt, $key, $salt); <add> <add> $salt = 'humpty dumpty had a great fall.'; <add> $this->assertFalse(Security::decrypt($result, $key, $salt), 'Modified salt causes failure.'); <add> } <add> <ide> /** <ide> * Test that short keys cause errors <ide> * <ide><path>lib/Cake/Utility/Security.php <ide> protected static function _crypt($password, $salt = false) { <ide> * <ide> * @param string $plain The value to encrypt. <ide> * @param string $key The 256 bit/32 byte key to use as a cipher key. <add> * @param string $hmacSalt The salt to use for the HMAC process. Leave null to use Security.salt. <ide> * @return string Encrypted data. <ide> * @throws CakeException On invalid data or key. <ide> */ <del> public static function encrypt($plain, $key) { <add> public static function encrypt($plain, $key, $hmacSalt = null) { <ide> self::_checkKey($key, 'encrypt()'); <ide> if (empty($plain)) { <ide> throw new CakeException(__d('cake_dev', 'The data to encrypt cannot be empty.')); <ide> } <del> $key = substr($key, 0, 32); <add> if ($hmacSalt === null) { <add> $hmacSalt = Configure::read('Security.salt'); <add> } <add> <add> // Generate the encryption and hmac key. <add> $key = substr(hash('sha256', $key . $hmacSalt), 0, 32); <add> <ide> $algorithm = MCRYPT_RIJNDAEL_128; <ide> $mode = MCRYPT_MODE_CBC; <ide> <ide> $ivSize = mcrypt_get_iv_size($algorithm, $mode); <del> $iv = mcrypt_create_iv($ivSize, MCRYPT_RAND); <del> return $iv . mcrypt_encrypt($algorithm, $key, $plain, $mode, $iv); <add> $iv = mcrypt_create_iv($ivSize, MCRYPT_DEV_URANDOM); <add> $ciphertext = $iv . mcrypt_encrypt($algorithm, $key, $plain, $mode, $iv); <add> $hmac = hash_hmac('sha256', $ciphertext, $key); <add> return $hmac . $ciphertext; <ide> } <ide> <ide> /** <ide> protected static function _checkKey($key, $method) { <ide> * <ide> * @param string $cipher The ciphertext to decrypt. <ide> * @param string $key The 256 bit/32 byte key to use as a cipher key. <add> * @param string $hmacSalt The salt to use for the HMAC process. Leave null to use Security.salt. <ide> * @return string Decrypted data. Any trailing null bytes will be removed. <ide> * @throws CakeException On invalid data or key. <ide> */ <del> public static function decrypt($cipher, $key) { <add> public static function decrypt($cipher, $key, $hmacSalt = null) { <ide> self::_checkKey($key, 'decrypt()'); <ide> if (empty($cipher)) { <ide> throw new CakeException(__d('cake_dev', 'The data to decrypt cannot be empty.')); <ide> } <del> $key = substr($key, 0, 32); <add> if ($hmacSalt === null) { <add> $hmacSalt = Configure::read('Security.salt'); <add> } <add> <add> // Generate the encryption and hmac key. <add> $key = substr(hash('sha256', $key . $hmacSalt), 0, 32); <add> <add> // Split out hmac for comparison <add> $macSize = 64; <add> $hmac = substr($cipher, 0, $macSize); <add> $cipher = substr($cipher, $macSize); <add> <add> $compareHmac = hash_hmac('sha256', $cipher, $key); <add> if ($hmac !== $compareHmac) { <add> return false; <add> } <ide> <ide> $algorithm = MCRYPT_RIJNDAEL_128; <ide> $mode = MCRYPT_MODE_CBC;
2
PHP
PHP
use the diffformatter hook provided by chronos
aaf981784913bcbde17ecfc88ad166f86932dad1
<ide><path>src/I18n/Date.php <ide> class Date extends MutableDate implements JsonSerializable <ide> */ <ide> public function timeAgoInWords(array $options = []) <ide> { <del> return RelativeTimeFormatter::dateAgoInWords($this, $options); <add> return $this->diffFormatter()->dateAgoInWords($this, $options); <ide> } <ide> } <ide><path>src/I18n/DateFormatTrait.php <ide> */ <ide> namespace Cake\I18n; <ide> <add>use Cake\I18n\RelativeTimeFormatter; <ide> use DateTime; <ide> use IntlDateFormatter; <ide> <ide> public function jsonSerialize() <ide> return $this->i18nFormat(static::$_jsonEncodeFormat); <ide> } <ide> <add> /** <add> * Get the difference formatter instance or overwrite the current one. <add> * <add> * @param \Cake\I18n\RelativeTimeFormatter|null $formatter The formatter instance when setting. <add> * @return \Cake\I18n\RelativeTimeFormatter The formatter instance. <add> */ <add> public function diffFormatter($formatter = null) <add> { <add> if ($formatter === null) { <add> // Use the static property defined in chronos. <add> if (static::$diffFormatter === null) { <add> static::$diffFormatter = new RelativeTimeFormatter(); <add> } <add> return static::$diffFormatter; <add> } <add> return static::$diffFormatter = $translator; <add> } <add> <ide> /** <ide> * Returns the data that should be displayed when debugging this object <ide> * <ide><path>src/I18n/FrozenDate.php <ide> class FrozenDate extends ChronosDate implements JsonSerializable <ide> */ <ide> public function timeAgoInWords(array $options = []) <ide> { <del> return RelativeTimeFormatter::dateAgoInWords($this, $options); <add> return $this->diffFormatter()->dateAgoInWords($this, $options); <ide> } <ide> } <ide><path>src/I18n/FrozenTime.php <ide> public function __construct($time = null, $tz = null) <ide> */ <ide> public function timeAgoInWords(array $options = []) <ide> { <del> return RelativeTimeFormatter::timeAgoInWords($this, $options); <add> return $this->diffFormatter()->timeAgoInWords($this, $options); <ide> } <ide> <ide> /** <ide><path>src/I18n/RelativeTimeFormatter.php <ide> */ <ide> namespace Cake\I18n; <ide> <add>use Cake\Chronos\ChronosInterface; <ide> use DatetimeInterface; <ide> <ide> /** <ide> */ <ide> class RelativeTimeFormatter <ide> { <add> /** <add> * Get the difference in a human readable format. <add> * <add> * @param \Cake\Chronos\ChronosInterface $date The datetime to start with. <add> * @param \Cake\Chronos\ChronosInterface|null $other The datetime to compare against. <add> * @param bool $absolute removes time difference modifiers ago, after, etc <add> * @return string The difference between the two days in a human readable format <add> * @see Cake\Chronos\ChronosInterface::diffForHumans <add> */ <add> public function diffForHumans(ChronosInterface $date, ChronosInterface $other = null, $absolute = false) <add> { <add> $isNow = $other === null; <add> if ($isNow) { <add> $other = $date->now($date->tz); <add> } <add> $diffInterval = $date->diff($other); <add> <add> switch (true) { <add> case ($diffInterval->y > 0): <add> $count = $diffInterval->y; <add> $message = __dn('cake', '{0} year', '{0} years', $count, $count); <add> break; <add> case ($diffInterval->m > 0): <add> $count = $diffInterval->m; <add> $message = __dn('cake', '{0} month', '{0} months', $count, $count); <add> break; <add> case ($diffInterval->d > 0): <add> $count = $diffInterval->d; <add> if ($count >= ChronosInterface::DAYS_PER_WEEK) { <add> $count = (int)($count / ChronosInterface::DAYS_PER_WEEK); <add> $message = __dn('cake', '{0} week', '{0} weeks', $count, $count); <add> } else { <add> $message = __dn('cake', '{0} day', '{0} days', $count, $count); <add> } <add> break; <add> case ($diffInterval->h > 0): <add> $count = $diffInterval->h; <add> $message = __dn('cake', '{0} hour', '{0} hours', $count, $count); <add> break; <add> case ($diffInterval->i > 0): <add> $count = $diffInterval->i; <add> $message = __dn('cake', '{0} minute', '{0} minutes', $count, $count); <add> break; <add> default: <add> $count = $diffInterval->s; <add> $message = __dn('cake', '{0} second', '{0} seconds', $count, $count); <add> break; <add> } <add> if ($absolute) { <add> return $message; <add> } <add> $isFuture = $diffInterval->invert === 1; <add> if ($isNow) { <add> return $isFuture ? __d('cake', '{0} from now', $message) : __d('cake', '{0} ago', $message); <add> } <add> return $isFuture ? __d('cake', '{0} after', $message) : __d('cake', '{0} before', $message); <add> } <add> <ide> /** <ide> * Format a into a relative timestring. <ide> * <ide> class RelativeTimeFormatter <ide> * @return string Relative time string. <ide> * @see Cake\I18n\Time::timeAgoInWords() <ide> */ <del> public static function timeAgoInWords(DatetimeInterface $time, array $options = []) <add> public function timeAgoInWords(DatetimeInterface $time, array $options = []) <ide> { <del> $options = static::_options($options, FrozenTime::class); <add> $options = $this->_options($options, FrozenTime::class); <ide> if ($options['timezone']) { <ide> $time = $time->timezone($options['timezone']); <ide> } <ide> public static function timeAgoInWords(DatetimeInterface $time, array $options = <ide> return sprintf($options['absoluteString'], $time->i18nFormat($options['format'])); <ide> } <ide> <del> $diffData = static::_diffData($futureTime, $pastTime, $backwards, $options); <add> $diffData = $this->_diffData($futureTime, $pastTime, $backwards, $options); <ide> list($fNum, $fWord, $years, $months, $weeks, $days, $hours, $minutes, $seconds) = array_values($diffData); <ide> <ide> $relativeDate = []; <ide> public static function timeAgoInWords(DatetimeInterface $time, array $options = <ide> * @param array $options An array of options. <ide> * @return array An array of values. <ide> */ <del> protected static function _diffData($futureTime, $pastTime, $backwards, $options) <add> protected function _diffData($futureTime, $pastTime, $backwards, $options) <ide> { <ide> $diff = $futureTime - $pastTime; <ide> <ide> protected static function _diffData($futureTime, $pastTime, $backwards, $options <ide> * @return string Relative date string. <ide> * @see Cake\I18n\Date::timeAgoInWords() <ide> */ <del> public static function dateAgoInWords(DatetimeInterface $date, array $options = []) <add> public function dateAgoInWords(DatetimeInterface $date, array $options = []) <ide> { <del> $options = static::_options($options, FrozenDate::class); <add> $options = $this->_options($options, FrozenDate::class); <ide> if ($options['timezone']) { <ide> $date = $date->timezone($options['timezone']); <ide> } <ide> public static function dateAgoInWords(DatetimeInterface $date, array $options = <ide> return sprintf($options['absoluteString'], $date->i18nFormat($options['format'])); <ide> } <ide> <del> $diffData = static::_diffData($futureTime, $pastTime, $backwards, $options); <add> $diffData = $this->_diffData($futureTime, $pastTime, $backwards, $options); <ide> list($fNum, $fWord, $years, $months, $weeks, $days, $hours, $minutes, $seconds) = array_values($diffData); <ide> <ide> $relativeDate = []; <ide> public static function dateAgoInWords(DatetimeInterface $date, array $options = <ide> * @param string $class The class name to use for defaults. <ide> * @return array Options with defaults applied. <ide> */ <del> protected static function _options($options, $class) <add> protected function _options($options, $class) <ide> { <ide> $options += [ <ide> 'from' => $class::now(), <ide><path>src/I18n/Time.php <ide> public function __construct($time = null, $tz = null) <ide> */ <ide> public function timeAgoInWords(array $options = []) <ide> { <del> return RelativeTimeFormatter::timeAgoInWords($this, $options); <add> return $this->diffFormatter()->timeAgoInWords($this, $options); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/I18n/TimeTest.php <ide> public function testToStringInvalidZeros($class) <ide> public function testDiffForHumans($class) <ide> { <ide> $time = new $class('2014-04-20 10:10:10'); <add> <ide> $other = new $class('2014-04-27 10:10:10'); <ide> $this->assertEquals('1 week before', $time->diffForHumans($other)); <ide> <ide> public function testDiffForHumans($class) <ide> <ide> $other = new $class('2014-04-13 09:10:10'); <ide> $this->assertEquals('1 week after', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-06 09:10:10'); <add> $this->assertEquals('2 weeks after', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-21 10:10:10'); <add> $this->assertEquals('1 day before', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-22 10:10:10'); <add> $this->assertEquals('2 days before', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-20 10:11:10'); <add> $this->assertEquals('1 minute before', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-20 10:12:10'); <add> $this->assertEquals('2 minutes before', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-20 10:10:09'); <add> $this->assertEquals('1 second after', $time->diffForHumans($other)); <add> <add> $other = new $class('2014-04-20 10:10:08'); <add> $this->assertEquals('2 seconds after', $time->diffForHumans($other)); <add> } <add> <add> /** <add> * Tests diffForHumans absolute <add> * <add> * @dataProvider classNameProvider <add> * @return void <add> */ <add> public function testDiffForHumansAbsolute($class) <add> { <add> $time = new $class('2014-04-20 10:10:10'); <add> $this->assertEquals('1 year', $time->diffForHumans(null, ['absolute' => true])); <add> <add> $other = new $class('2014-04-27 10:10:10'); <add> $this->assertEquals('1 week', $time->diffForHumans($other, ['absolute' => true])); <add> <add> $time = new $class('2016-04-20 10:10:10'); <add> $this->assertEquals('4 months', $time->diffForHumans(null, ['absolute' => true])); <add> } <add> <add> /** <add> * Tests diffForHumans with now <add> * <add> * @dataProvider classNameProvider <add> * @return void <add> */ <add> public function testDiffForHumansNow($class) <add> { <add> $time = new $class('2014-04-20 10:10:10'); <add> $this->assertEquals('1 year ago', $time->diffForHumans()); <add> <add> $time = new $class('2016-04-20 10:10:10'); <add> $this->assertEquals('4 months from now', $time->diffForHumans()); <ide> } <ide> <ide> /**
7
Javascript
Javascript
add singleentryplugin as deprecated export
2dc22d0db0dd204dd4406af89ccc4747eae6cedb
<ide><path>lib/SingleEntryPlugin.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add> Author Sean Larkin @thelarkinn <add>*/ <add> <add>"use strict"; <add> <add>module.exports = require("./EntryPlugin"); <ide><path>lib/webpack.js <ide> <ide> "use strict"; <ide> <add>const util = require("util"); <ide> const version = require("../package.json").version; <ide> const webpackOptionsSchema = require("../schemas/WebpackOptions.json"); <ide> const Compiler = require("./Compiler"); <ide> exportPlugins(exports, { <ide> PrefetchPlugin: () => require("./PrefetchPlugin"), <ide> ProgressPlugin: () => require("./ProgressPlugin"), <ide> ProvidePlugin: () => require("./ProvidePlugin"), <add> SingleEntryPlugin: util.deprecate( <add> () => require("./EntryPlugin"), <add> "SingleEntryPlugin was renamed to EntryPlugin" <add> ), <ide> SetVarMainTemplatePlugin: () => require("./SetVarMainTemplatePlugin"), <ide> SourceMapDevToolPlugin: () => require("./SourceMapDevToolPlugin"), <ide> Stats: () => require("./Stats"),
2
Javascript
Javascript
fix deprecation warning
ba042244de33a172e4d7bf2a3f486f5746bc8475
<ide><path>packages/ember-handlebars/tests/handlebars_test.js <ide> test("edge case: child conditional should not render children if parent conditio <ide> <ide> test("Template views return throw if their template cannot be found", function() { <ide> view = Ember.View.create({ <del> templateName: 'cantBeFound' <add> templateName: 'cantBeFound', <add> container: { lookup: function(){ }} <ide> }); <ide> <ide> expectAssertion(function() {
1
Python
Python
fix trivial model to work properly with fp16
c0b31c51fe5f7a763409048b4b5ecf8260289ced
<ide><path>official/resnet/keras/keras_imagenet_main.py <ide> def run(flags_obj): <ide> input_layer_batch_size = None <ide> <ide> if flags_obj.use_trivial_model: <del> model = trivial_model.trivial_model(imagenet_main.NUM_CLASSES) <add> model = trivial_model.trivial_model(imagenet_main.NUM_CLASSES, dtype) <ide> else: <ide> model = resnet_model.resnet50( <ide> num_classes=imagenet_main.NUM_CLASSES, <ide><path>official/resnet/keras/trivial_model.py <ide> from tensorflow.python.keras import models <ide> <ide> <del>def trivial_model(num_classes): <add>def trivial_model(num_classes, dtype='float32'): <ide> """Trivial model for ImageNet dataset.""" <ide> <ide> input_shape = (224, 224, 3) <del> img_input = layers.Input(shape=input_shape) <add> img_input = layers.Input(shape=input_shape, dtype=dtype) <ide> <ide> x = layers.Lambda(lambda x: backend.reshape(x, [-1, 224 * 224 * 3]), <ide> name='reshape')(img_input) <ide> x = layers.Dense(1, name='fc1')(x) <del> x = layers.Dense(num_classes, activation='softmax', name='fc1000')(x) <add> x = layers.Dense(num_classes, name='fc1000')(x) <add> # TODO(reedwm): Remove manual casts once mixed precision can be enabled with a <add> # single line of code. <add> x = backend.cast(x, 'float32') <add> x = layers.Activation('softmax')(x) <ide> <ide> return models.Model(img_input, x, name='trivial')
2
Java
Java
fix cacheable javadoc
90081f787f2f24e6ab73baa81c9b11510d87c799
<ide><path>spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java <ide> /** <ide> * Annotation indicating that a method (or all the methods on a class) can be cached. <ide> * <del> * <p>The method arguments and signature are used for computing the key while the <del> * returned instance is used as the cache value. <add> * <p>Each time a targeted method is invoked, a caching behavior will be applied, <add> * checking whether the method has been already executed for the given arguments. A <add> * sensible default simply uses the method parameters to compute the key but a SpEL <add> * expression can be provided ({@link #key()}) or a custom <add> * {@link org.springframework.cache.interceptor.KeyGenerator KeyGenerator} implementation <add> * can replace the default one ({@link #keyGenerator()}). <add> * <add> * <p>If no value is found in the cache for the computed key, the method is executed <add> * and the returned instance is used as the cache value. <ide> * <ide> * @author Costin Leau <ide> * @author Phillip Webb
1
Python
Python
update ec2 provider constant value
fe6c8a491f0c4b205b76069d1fef2c31e0e97897
<ide><path>libcloud/compute/types.py <ide> class Provider(Type): <ide> """ <ide> AZURE = 'azure' <ide> DUMMY = 'dummy' <del> EC2 = 'ec2_us_east' <add> EC2 = 'ec2' <ide> RACKSPACE = 'rackspace' <ide> GCE = 'gce' <ide> GOGRID = 'gogrid'
1
PHP
PHP
fix typo for function_exists
a3a80b44f059fd14627916a762694cd74579937f
<ide><path>src/Illuminate/Queue/Console/WorkCommand.php <ide> protected function gatherWorkerOptions() <ide> { <ide> $timeout = $this->option('timeout', 60); <ide> <del> if ($timeout && ! function_exist('pcntl_fork')) { <add> if ($timeout && ! function_exists('pcntl_fork')) { <ide> throw new RuntimeException('The pcntl extension is required in order to specify job timeouts.'); <ide> } <ide>
1
Ruby
Ruby
fix the shadowing warning for `reflection`
9b986eadf4514ebf175af5e23ddba6d754d08c5e
<ide><path>activerecord/lib/active_record/relation/merger.rb <ide> def merge_preloads <ide> relation.preload! other.preload_values unless other.preload_values.empty? <ide> relation.includes! other.includes_values unless other.includes_values.empty? <ide> else <del> reflection = relation.klass.reflect_on_all_associations.find do |reflection| <del> reflection.class_name == other.klass.name <add> reflection = relation.klass.reflect_on_all_associations.find do |r| <add> r.class_name == other.klass.name <ide> end || return <ide> <ide> unless other.preload_values.empty?
1
Text
Text
add information about .indexof()
d0911b8d650bd9b259bef3a9c8ee6d6200f94c97
<ide><path>guide/english/java/strings/index.md <ide> The result will be: <ide> Hello <ide> World <ide> ``` <add>We can find the index of a character in a string by using the function called ```.indexOf()```. This function allows us to know the exact index of a character making it easier to split a string with ```.substring()``` which you learn in the next example. <add>Example: <add>```java <add>String name = "Julie"; <add>System.out.println(name.indexOf("J")); <add>``` <add>Output: <add>``` <add>0 <add>``` <add>You can also use ```.indexOf()``` to find mulitple of the same character. <add>Example: <add>```java <add>String name = "name;city;state"; <add>int firstSemiColon = name.indexOf(";"); <add>int secondSemiColon = name.indexOf(";", firstSemiColon + 1); <add>System.out.println(firstSemiColon + " " + secondSemiColon); <add>``` <add>Output: <add>``` <add>4 9 <add>``` <add> <ide> We can also split the string by specifing the start and end index of the characters in the string. We will do this using the Java function called ```.substring()```. <ide> <ide> The ```.substring()``` method can be used in two ways. One with only the starting index and one with both the start and end index. Take note that the index starts from 0.
1
PHP
PHP
fix faking of model events
d6cb75c057009c6316d4efd865dccb3c4a5c7b36
<ide><path>src/Illuminate/Support/Facades/Event.php <ide> <ide> namespace Illuminate\Support\Facades; <ide> <add>use Illuminate\Database\Eloquent\Model; <ide> use Illuminate\Support\Testing\Fakes\EventFake; <ide> <ide> /** <ide> class Event extends Facade <ide> */ <ide> public static function fake() <ide> { <del> static::swap(new EventFake); <add> static::swap($fake = new EventFake); <add> <add> Model::setEventDispatcher($fake); <ide> } <ide> <ide> /**
1
PHP
PHP
set doc blocks
2fee0ed98563ad207b3467edc2be6ce68dc9fa93
<ide><path>src/Illuminate/Contracts/Routing/Middleware.php <ide> interface Middleware { <ide> /** <ide> * Handle an incoming request. <ide> * <del> * @param \Symfony\Component\HttpFoundation\Request $request <add> * @param \Illuminate\Http\Request $request <ide> * @param \Closure $next <del> * @return \Symfony\Component\HttpFoundation\Response <add> * @return mixed <ide> */ <ide> public function handle($request, Closure $next); <ide> <ide><path>src/Illuminate/Cookie/Guard.php <ide> public function __construct(EncrypterContract $encrypter) <ide> /** <ide> * Handle an incoming request. <ide> * <del> * @param \Symfony\Component\HttpFoundation\Request $request <add> * @param \Illuminate\Http\Request $request <ide> * @param \Closure $next <del> * @return \Symfony\Component\HttpFoundation\Response <add> * @return mixed <ide> */ <ide> public function handle($request, Closure $next) <ide> { <ide><path>src/Illuminate/Cookie/Queue.php <ide> public function __construct(CookieJar $cookies) <ide> /** <ide> * Handle an incoming request. <ide> * <del> * @param \Symfony\Component\HttpFoundation\Request $request <add> * @param \Illuminate\Http\Request $request <ide> * @param \Closure $next <del> * @return \Symfony\Component\HttpFoundation\Response <add> * @return mixed <ide> */ <ide> public function handle($request, Closure $next) <ide> { <ide><path>src/Illuminate/Session/Middleware/Reader.php <ide> public function __construct(SessionManager $manager) <ide> /** <ide> * Handle an incoming request. <ide> * <del> * @param \Symfony\Component\HttpFoundation\Request $request <add> * @param \Illuminate\Http\Request $request <ide> * @param \Closure $next <del> * @return \Symfony\Component\HttpFoundation\Response <add> * @return mixed <ide> */ <ide> public function handle($request, Closure $next) <ide> { <ide><path>src/Illuminate/Session/Middleware/Writer.php <ide> public function __construct(SessionManager $manager) <ide> /** <ide> * Handle an incoming request. <ide> * <del> * @param \Symfony\Component\HttpFoundation\Request $request <add> * @param \Illuminate\Http\Request $request <ide> * @param \Closure $next <del> * @return \Symfony\Component\HttpFoundation\Response <add> * @return mixed <ide> */ <ide> public function handle($request, Closure $next) <ide> {
5
PHP
PHP
fix a couple of bugs in the arr class
cd90845accf2090fd7b59162f69728b8b579f556
<ide><path>system/arr.php <ide> public static function get($array, $key, $default = null) <ide> <ide> foreach (explode('.', $key) as $segment) <ide> { <del> if ( ! array_key_exists($segment, $array)) <add> if ( ! is_array($array) or ! array_key_exists($segment, $array)) <ide> { <ide> return is_callable($default) ? call_user_func($default) : $default; <ide> } <ide> public static function set(&$array, $key, $value) <ide> { <ide> $key = array_shift($keys); <ide> <del> if ( ! isset($array[$key])) <add> if ( ! isset($array[$key]) or ! is_array($array[$key])) <ide> { <ide> $array[$key] = array(); <ide> }
1
PHP
PHP
rearrange hash class
a36e2773e2db425be08854f20dd189a1753e208a
<ide><path>laravel/hash.php <ide> <ide> class Hash { <ide> <add> /** <add> * Determine if an unhashed value matches a given Bcrypt hash. <add> * <add> * @param string $value <add> * @param string $hash <add> * @return bool <add> */ <add> public static function check($value, $hash) <add> { <add> return crypt($value, $hash) === $hash; <add> } <add> <ide> /** <ide> * Hash a password using the Bcrypt hashing scheme. <ide> * <ide> public static function make($value, $rounds = 8) <ide> return crypt($value, '$2a$'.$work.'$'.$salt); <ide> } <ide> <del> /** <del> * Determine if an unhashed value matches a given Bcrypt hash. <del> * <del> * @param string $value <del> * @param string $hash <del> * @return bool <del> */ <del> public static function check($value, $hash) <del> { <del> return crypt($value, $hash) === $hash; <del> } <del> <ide> } <ide>\ No newline at end of file
1
Javascript
Javascript
use resolverfactory.get with dep category option
ca95eccbe6509dc8db7a220cdc384e23a1f445fb
<ide><path>lib/ContextModuleFactory.js <ide> const { join } = require("./util/fs"); <ide> /** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ <ide> /** @typedef {import("./dependencies/ContextDependency")} ContextDependency */ <ide> <del>const EMPTY_RESOLVE_OPTIONS = {}; <del> <ide> module.exports = class ContextModuleFactory extends ModuleFactory { <ide> constructor(resolverFactory) { <ide> super(); <ide> module.exports = class ContextModuleFactory extends ModuleFactory { <ide> <ide> const contextResolver = this.resolverFactory.get( <ide> "context", <del> resolveOptions || EMPTY_RESOLVE_OPTIONS <del> ); <del> const loaderResolver = this.resolverFactory.get( <del> "loader", <del> EMPTY_RESOLVE_OPTIONS <add> resolveOptions || undefined, <add> dependencies.length > 0 ? dependencies[0].category : undefined <ide> ); <add> const loaderResolver = this.resolverFactory.get("loader"); <ide> <ide> asyncLib.parallel( <ide> [ <ide><path>lib/container/OverridablesPlugin.js <ide> class OverridablesPlugin { <ide> /** @type {LazySet<string>} */ <ide> missingDependencies: new LazySet() <ide> }; <del> const resolver = compilation.resolverFactory.get("normal"); <add> const resolver = compilation.resolverFactory.get( <add> "normal", <add> undefined, <add> "esm" <add> ); <add> <ide> /** <ide> * @param {string} request imported request <ide> * @param {string} name overridable name
2
Java
Java
add test for leakawaredatabufferfactory
63275ae2b750af8d5ea78cc1f0395b536c8b0a55
<ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBuffer.java <ide> class LeakAwareDataBuffer implements PooledDataBuffer { <ide> Assert.notNull(dataBufferFactory, "DataBufferFactory must not be null"); <ide> this.delegate = delegate; <ide> this.dataBufferFactory = dataBufferFactory; <del> this.leakError = createLeakError(); <add> this.leakError = createLeakError(delegate); <ide> } <ide> <del> private static AssertionError createLeakError() { <del> AssertionError result = new AssertionError("Leak detected in test case"); <add> private static AssertionError createLeakError(DataBuffer delegate) { <add> String message = String.format("DataBuffer leak detected: {%s} has not been released.%n" + <add> "Stack trace of buffer allocation statement follows:", <add> delegate); <add> AssertionError result = new AssertionError(message); <ide> // remove first four irrelevant stack trace elements <ide> StackTraceElement[] oldTrace = result.getStackTrace(); <ide> StackTraceElement[] newTrace = new StackTraceElement[oldTrace.length - 4]; <ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java <ide> import java.util.ArrayList; <ide> import java.util.List; <ide> <add>import org.jetbrains.annotations.NotNull; <ide> import org.junit.After; <ide> <ide> import org.springframework.util.Assert; <ide> public void checkForLeaks() { <ide> } <ide> <ide> @Override <del> public LeakAwareDataBuffer allocateBuffer() { <del> LeakAwareDataBuffer dataBuffer = <del> new LeakAwareDataBuffer(this.delegate.allocateBuffer(), this); <del> this.created.add(dataBuffer); <del> return dataBuffer; <add> public DataBuffer allocateBuffer() { <add> return allocateBufferInternal(this.delegate.allocateBuffer()); <ide> } <ide> <ide> @Override <del> public LeakAwareDataBuffer allocateBuffer(int initialCapacity) { <del> LeakAwareDataBuffer dataBuffer = <del> new LeakAwareDataBuffer(this.delegate.allocateBuffer(initialCapacity), this); <add> public DataBuffer allocateBuffer(int initialCapacity) { <add> return allocateBufferInternal(this.delegate.allocateBuffer(initialCapacity)); <add> } <add> <add> @NotNull <add> private DataBuffer allocateBufferInternal(DataBuffer delegateBuffer) { <add> LeakAwareDataBuffer dataBuffer = new LeakAwareDataBuffer(delegateBuffer, this); <ide> this.created.add(dataBuffer); <ide> return dataBuffer; <ide> } <ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java <add>/* <add> * Copyright 2002-2018 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.core.io.buffer; <add> <add>import org.junit.Test; <add> <add>import static org.junit.Assert.*; <add>import static org.springframework.core.io.buffer.DataBufferUtils.release; <add> <add>/** <add> * @author Arjen Poutsma <add> */ <add>public class LeakAwareDataBufferFactoryTests { <add> <add> private final LeakAwareDataBufferFactory bufferFactory = new LeakAwareDataBufferFactory(); <add> <add> <add> @Test <add> public void leak() { <add> DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(); <add> try { <add> this.bufferFactory.checkForLeaks(); <add> fail("AssertionError expected"); <add> } <add> catch (AssertionError expected) { <add> // ignore <add> } <add> finally { <add> release(dataBuffer); <add> } <add> } <add> <add> @Test <add> public void noLeak() { <add> DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(); <add> release(dataBuffer); <add> this.bufferFactory.checkForLeaks(); <add> } <add> <add>} <ide>\ No newline at end of file
3
Python
Python
make sure correct backend is used
994dc428ea4611d669c6d7f5c530a36daa904b11
<ide><path>celery/result.py <ide> def children(self): <ide> def restore(self, id, backend=None): <ide> """Restore previously saved group result.""" <ide> return ( <del> backend or self.app.backend if self.app else current_app.backend <add> backend or (self.app.backend if self.app else current_app.backend) <ide> ).restore_group(id) <ide> <ide>
1
Text
Text
add bitbucket pipelines to errors/no-cache.md
60e62241a8c20e22b3117096a0cbb3f9e4881b79
<ide><path>errors/no-cache.md <ide> cache: <ide> - 'node_modules/**/*' # Cache `node_modules` for faster `yarn` or `npm i` <ide> - '.next/cache/**/*' # Cache Next.js for faster application rebuilds <ide> ``` <add> <add>**Bitbucket Pipelines** <add> <add>Add or merge the following into your `bitbucket-pipelines.yml` at the top level (same level as `pipelines`): <add> <add>```yaml <add>definitions: <add> caches: <add> nextcache: .next/cache <add>``` <add> <add>Then reference it in the `caches` section of your pipeline's `step`: <add> <add>```yaml <add>- step: <add> name: your_step_name <add> caches: <add> - node <add> - nextcache <add>```
1
Ruby
Ruby
make the serializable test much looser
f74ddc8a4c748c3fb8ae7e03a5a211f87c025182
<ide><path>activerecord/test/cases/transaction_isolation_test.rb <ide> class Tag2 < ActiveRecord::Base <ide> assert_equal 'emily', tag.name <ide> end <ide> <del> # We are testing that a non-serializable sequence of statements will raise <del> # an error. <add> # We are only testing that there are no errors because it's too hard to <add> # test serializable. Databases behave differently to enforce the serializability <add> # constraint. <ide> test "serializable" do <del> if Tag2.connection.adapter_name =~ /mysql/i <del> # Unfortunately it cannot be set to 0 <del> Tag2.connection.execute "SET innodb_lock_wait_timeout = 1" <del> end <del> <del> assert_raises ActiveRecord::StatementInvalid do <del> Tag.transaction(isolation: :serializable) do <del> Tag.create <del> <del> Tag2.transaction(isolation: :serializable) do <del> Tag2.create <del> Tag2.count <del> end <del> <del> Tag.count <del> end <add> Tag.transaction(isolation: :serializable) do <add> Tag.create <ide> end <ide> end <ide>
1
Go
Go
change v1 pull 404 message to include tag
745892a7b271cf0f1770a8ec3698aaf61573e5f2
<ide><path>distribution/pull_v1.go <ide> func (p *v1Puller) Pull(ctx context.Context, ref reference.Named) error { <ide> func (p *v1Puller) pullRepository(ctx context.Context, ref reference.Named) error { <ide> progress.Message(p.config.ProgressOutput, "", "Pulling repository "+p.repoInfo.FullName()) <ide> <add> tagged, isTagged := ref.(reference.NamedTagged) <add> <ide> repoData, err := p.session.GetRepositoryData(p.repoInfo) <ide> if err != nil { <ide> if strings.Contains(err.Error(), "HTTP code: 404") { <add> if isTagged { <add> return fmt.Errorf("Error: image %s:%s not found", p.repoInfo.RemoteName(), tagged.Tag()) <add> } <ide> return fmt.Errorf("Error: image %s not found", p.repoInfo.RemoteName()) <ide> } <ide> // Unexpected HTTP error <ide> func (p *v1Puller) pullRepository(ctx context.Context, ref reference.Named) erro <ide> <ide> logrus.Debugf("Retrieving the tag list") <ide> var tagsList map[string]string <del> tagged, isTagged := ref.(reference.NamedTagged) <ide> if !isTagged { <ide> tagsList, err = p.session.GetRemoteTags(repoData.Endpoints, p.repoInfo) <ide> } else { <ide><path>integration-cli/docker_cli_logout_test.go <ide> func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) <ide> // check I cannot pull anymore <ide> out, _, err := dockerCmdWithError("--config", tmp, "pull", repoName) <ide> c.Assert(err, check.NotNil, check.Commentf(out)) <del> c.Assert(out, checker.Contains, fmt.Sprintf("Error: image dockercli/busybox not found")) <add> c.Assert(out, checker.Contains, "Error: image dockercli/busybox:authtest not found") <ide> } <ide><path>integration-cli/docker_cli_pull_test.go <ide> func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> <ide> type entry struct { <del> Repo string <del> Alias string <add> repo string <add> alias string <add> tag string <ide> } <ide> <ide> entries := []entry{ <del> {"library/asdfasdf", "asdfasdf:foobar"}, <del> {"library/asdfasdf", "library/asdfasdf:foobar"}, <del> {"library/asdfasdf", "asdfasdf"}, <del> {"library/asdfasdf", "asdfasdf:latest"}, <del> {"library/asdfasdf", "library/asdfasdf"}, <del> {"library/asdfasdf", "library/asdfasdf:latest"}, <add> {"library/asdfasdf", "asdfasdf", "foobar"}, <add> {"library/asdfasdf", "library/asdfasdf", "foobar"}, <add> {"library/asdfasdf", "asdfasdf", ""}, <add> {"library/asdfasdf", "asdfasdf", "latest"}, <add> {"library/asdfasdf", "library/asdfasdf", ""}, <add> {"library/asdfasdf", "library/asdfasdf", "latest"}, <ide> } <ide> <ide> // The option field indicates "-a" or not. <ide> func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) { <ide> group.Add(1) <ide> go func(e entry) { <ide> defer group.Done() <del> out, err := s.CmdWithError("pull", e.Alias) <add> repoName := e.alias <add> if e.tag != "" { <add> repoName += ":" + e.tag <add> } <add> out, err := s.CmdWithError("pull", repoName) <ide> recordChan <- record{e, "", out, err} <ide> }(e) <del> if !strings.ContainsRune(e.Alias, ':') { <add> if e.tag == "" { <ide> // pull -a on a nonexistent registry should fall back as well <ide> group.Add(1) <ide> go func(e entry) { <ide> defer group.Done() <del> out, err := s.CmdWithError("pull", "-a", e.Alias) <add> out, err := s.CmdWithError("pull", "-a", e.alias) <ide> recordChan <- record{e, "-a", out, err} <ide> }(e) <ide> } <ide> func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) { <ide> // Hub returns 401 rather than 404 for nonexistent repos over <ide> // the v2 protocol - but we should end up falling back to v1, <ide> // which does return a 404. <del> c.Assert(record.out, checker.Contains, fmt.Sprintf("Error: image %s not found", record.e.Repo), check.Commentf("expected image not found error messages")) <add> tag := record.e.tag <add> if tag == "" { <add> tag = "latest" <add> } <add> c.Assert(record.out, checker.Contains, fmt.Sprintf("Error: image %s:%s not found", record.e.repo, tag), check.Commentf("expected image not found error messages")) <ide> } else { <ide> // pull -a on a nonexistent registry should fall back as well <ide> c.Assert(record.err, checker.NotNil, check.Commentf("expected non-zero exit status when pulling non-existing image: %s", record.out)) <del> c.Assert(record.out, checker.Contains, fmt.Sprintf("Error: image %s not found", record.e.Repo), check.Commentf("expected image not found error messages")) <add> c.Assert(record.out, checker.Contains, fmt.Sprintf("Error: image %s not found", record.e.repo), check.Commentf("expected image not found error messages")) <ide> c.Assert(record.out, checker.Not(checker.Contains), "unauthorized", check.Commentf(`message should not contain "unauthorized"`)) <ide> } <ide> } <ide> func (s *DockerRegistryAuthHtpasswdSuite) TestPullNoCredentialsNotFound(c *check <ide> // gives a 404 (in this case the test registry doesn't handle v1 at all) <ide> out, _, err := dockerCmdWithError("pull", privateRegistryURL+"/busybox") <ide> c.Assert(err, check.NotNil, check.Commentf(out)) <del> c.Assert(out, checker.Contains, "Error: image busybox not found") <add> c.Assert(out, checker.Contains, "Error: image busybox:latest not found") <ide> }
3
PHP
PHP
fix engine issueing
70e504da5ad395d87467826e528dc9edf3f36ef3
<ide><path>src/Illuminate/View/Factory.php <ide> protected function getExtension($path) <ide> $extensions = array_keys($this->extensions); <ide> <ide> return Arr::first($extensions, function ($key, $value) use ($path) { <del> return Str::endsWith($path, $value); <add> return Str::endsWith($path, '.'.$value); <ide> }); <ide> } <ide>
1